2 ms·
wrong, rust is about exclusive ptr access, nothing more. you cannot do ReadOnly<T> in rust.
by cztomsik 4y ago
wrong, rust is about exclusive ptr access, nothing more. you cannot do ReadOnly<T> in rust.
- pg999w 4y agoWhy not? Isn't that &T like a read only wrapper of T?
- cztomsik 4y agotry to do ReadOnly<T> yourself, and then put Cell into it, or RwLock, or Mutex, or Atomic, or crossbeam channel, ... it LOOKS like it's possible but it can be broken easily. again, because rust is not really about (i)mutability, it's about mem-safety - and all of those can be safely mutated with &T