3 unstable releases

0.2.0 Oct 13, 2020
0.1.1 Oct 13, 2020
0.1.0 Oct 5, 2020

#2714 in Rust patterns


Used in reference-counted

CC-PDDC license

7KB

Smart Pointer

A rust module specifying traits for smart pointer functionality, i.e. shared ownership of values. The main intention is to enable data structures that are parameterized by the pointer type to be used internally, allowing the user to enable features such as thread-safety or the ability to handle self-containment as needed. The traits can also serve as a feature checklist for implementers of smart pointers.

See the module documentation for more details.

Note that the usage of this crate remains fairly restricted as long as rust does not support higher-kinded types. The archery crate emulates higher-kinded smart pointers, but has a coarser interface than this crate.


lib.rs:

Traits for smart pointer functionality.

The basic traits are SmartPointer and SmartPointerMut for basic creation, obtaining ownership, borrowing and dereferencing. Further subtraits expose more specialized functionality which is nonetheless applicable to any sort of smart pointer.

These additional, specialized traits are being added to this crate as consumers need them. If you would like to see traits for additional features, e.g. conversion with raw pointers, efficient borrows, pointers directly to the data or thin DST pointers, open an issue.

Dependencies

~8KB