|
|
|
|
|
by 0815test
2547 days ago
|
|
Cell<T> (1) is not safe to reference across threads, and (2) can only mutate via the equivalent of a memcpy. It can be useful in many ways, but there is a real sense in which &T and &mut T (which would probably be called &uniq T, if Rust devs cared about theoretical cleanness over reusing short keywords!) are truly fundamental. |
|
The same could be done for struct fields if the type system knew about it, and the whole thing could just use normal syntax.
Sharing between threads still needs &T or &mut T (or an owned value), but that's not usually involved in the painful cases.