Re:Why writing a linked list in safe Rust is so damned hard
by vvanders on Thursday February 22, 2018 @07:49PM
(#16443143)
Yes but single owner and refcount of 1 are semantically the same. If you want to be strict about this just keep the Rc private to the implementations and only hand out Weak<T>.
[ Parent
| on HN ]
Re:Why writing a linked list in safe Rust is so damned hard
by mehrdadn on Thursday February 22, 2018 @07:52PM
(#16443173)
So you're suggesting we add a refcount to every value because it can be made to be semantically the same as not having one?
Re:Why writing a linked list in safe Rust is so damned hard
by vvanders on Thursday February 22, 2018 @07:56PM
(#16443206)
If you want to stay in safe Rust, sure. If that's too much overhead feel free to drop down to unsafe and do it just like in C/C++.
FWIW Rc is pretty lightweight. Arc is the heavier(and threadsafe) variant.