Expand description
Smart pointer for graph nodes.
The author of this crate is not good at English. Forgive me if the document is hard to read.
This crate provides some smart pointers optimized for managing graph data structures.
Nr
- likeRc
Nw
- likeWeak
.NrCell
- newtype ofNr<RefCell<T>>
.NwCell
- newtype ofNw<RefCell<T>>
.
These smart pointers behavior is similar to Rc
and Weak
.
However, there are several important differences between them.
§Point1 - Comparison of smart pointers
This crate smart pointer comparison is based on location.
This allows smart pointers to be used as HashSet
values, etc.
For example, comparison of Nr::eq
is based on identity of node address.
On the other hand comparison of Rc::eq
is based on inner value.
§Point2 - Upgrade from weak pointer
This crate weak pointer supports upgrade to strong pointer reference.
This allows smart pointers act as dynamic object directly.
For example, Nw::upgrade_ref
returns Nr
reference.
On the other hand Nw::upgrade
returns Nr
itself.
This is semilar to Weak::upgrade
that returns Rc
itself.
Structs§
- Strong reference to node.
- Strong reference to cell node.
- Weak reference to node.
- Weak reference to cell node.