3 ms·
Option<Rc<RefCell<_>>> is not the same thing as a pointer, as the semantics are different, and it uses much more memory than an actual pointer. Rust has pointe
by sph 4y ago
Option<Rc<RefCell<_>>> is not the same thing as a pointer, as the semantics are different, and it uses much more memory than an actual pointer.
Rust has pointers. If you want to program like old school C++, wrap everything in unsafe and use all the pointers you want.
- scotty79 4y agoI don't want unsafe. I just want it to be out of my hair. RefCell is perfectly safe.
- zamalek 4y ago> wrap everything in unsafe You are expected to follow Rust's memory model in unsafe blocks. Treating unsafe Rust like C is much more dangerous than just using C.
- SpaghettiCthulu 4y agoAssuming you're talking about the aliasing rules, my understanding is that that only applies if you are mixing pointers with references. If you just use `pointer::read` `pointer::write` the aliasing rules don't apply (doesn't mean it's safe, but it won't immediately be undefined behaviour to write to a mutable pointer while another mutable pointer exists, as it would be if you aliased a mutable reference).