Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are weak references in Rust. https://doc.rust-lang.org/std/rc/struct.Weak.html

The way it works is, in order to use it you try to upgrade it to a normal Refcounted pointer. Since it is a weak reference, this upgrade may of course fail and in that case return None (in place of a null pointer). When this upgraded pointer dies (either goes out of scope or is manually downgraded) the refcount will again be updated.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: