this post was submitted on 08 Oct 2025
18 points (100.0% liked)
Rust
7653 readers
10 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Maybe. My point is that unless you want to, for example, have a reference that you switch between which object it references, I think you would be fine with using the ref-counted reference. With eventual optimization done via compiler when it's sure the code won't be trying to access the object after it got deleted. But even if I'm wrong, there could be another way to get a pure reference
Yes, and IMO by using
Handlefor that it breaks a pattern. Rust keeps*and&for speaking about values and memory management (I want data vs I want reference). Using a trait for ref-counted referencing adds another layer. So suddenly we have*,&and::Handle(). You see what I'm getting at?