5 unstable releases

0.3.2 Nov 30, 2024
0.3.1 Nov 30, 2024
0.3.0 Nov 25, 2024
0.2.0 Feb 12, 2024
0.1.0 Feb 11, 2024

#782 in Rust patterns

Download history 5/week @ 2024-09-23 2/week @ 2024-11-04 388/week @ 2024-11-25 34/week @ 2024-12-02 23/week @ 2024-12-09

445 downloads per month

MIT/Apache

10KB
177 lines

easy_node

Smart pointer for graph nodes.

The author of this crate is not good at English.
Forgive me if the document is hard to read.

What is this?

This crate provides some smart pointers optimized for managing graph data structures.

  • Nr - like Rc
  • Nw - like Weak.

These smart pointers behavior is similar to Rc and Weak.
However, These smart pointer comparison is location based.

Other options

by_address is a great crate with similar purpose.

It supports location based comparison too. But unlike this crate, it can target any type that implements Deref trait. And therefore, Weak that does not implement Deref need other support.

On the other hand, this crate specializes on Rc and Weak. Instead, we discard other smart pointers like Box. This is because this crate assumes only nodes in graph or network.

Unsize handling

As of 2024, to support unsize conversions with smart pointers, unstable feature CoerceUnsized is required. So, Rc<Type> to Rc<dyn Trait> conversion is supported, but Nr<Type> to Nr<dyn Trait> is not.

As workaround, we provide inter-conversions between Nr and Rc, and between Nw and Weak. Nr and Nw functions as_base, from_base, and base are them.

What's New?

v0.3.2

  • Edit documentation.

v0.3.1

  • Add prelude module.
  • Edit documentation.

v0.3.0

  • Obsolete upgrade_ref method (unsafe misusing...).
  • Obsolete NrCell and NwCell (not essential...).
  • Add base, as_base, from_base method.

No runtime deps