🔬 This is a nightly-only experimental API. (
this library is unlikely to be stabilized in its current form or name
This library provides smart pointers and collections for managing heap-allocated values.
This library, like libcore, is not intended for general usage, but rather as a building block of other libraries. The types and interfaces in this library are re-exported through the standard library, and should not be used through this library.
Box type is a smart pointer type. There can
only be one owner of a
Box, and the owner can decide to mutate the
contents, which live on the heap.
This type can be sent among threads efficiently as the size of a
is the same as that of a pointer. Tree-like data structures are often built
with boxes because each node often has only one owner, the parent.
Rc type is a non-threadsafe reference-counted pointer
type intended for sharing memory within a thread. An
Rc pointer wraps a
T, and only allows access to
&T, a shared reference.
This type is useful when inherited mutability (such as using
Box) is too
constraining for an application, and is often paired with the
RefCell types in order to allow mutation.
Arc type is the threadsafe equivalent of the
type. It provides all the same functionality of
Rc, except it requires
that the contained type
T is shareable. Additionally,
Arc<T> is itself
Rc<T> is not.
This type allows for shared access to the contained data, and is often paired with synchronization primitives such as mutexes to allow mutation of shared resources.
Implementations of the most common general purpose data structures are defined in this library. They are re-exported through the standard collections library.
alloc module defines the low-level interface to the
default global allocator. It is not compatible with the libc allocator API.
Thread-safe reference-counting pointers.
A priority queue implemented with a binary heap.
A module for working with borrowed data.
A pointer type for heap allocation.
A map based on a B-Tree.
A set based on a B-Tree.
Utilities for formatting and printing
A doubly-linked list with owned nodes.
Single-threaded reference-counting pointers. 'Rc' stands for 'Reference Counted'.
A dynamically-sized view into a contiguous sequence,
Unicode string slices.
A UTF-8 encoded, growable string.
A contiguous growable array type with heap-allocated contents, written
A double-ended queue implemented with a growable ring buffer.