Skip to main content

Crate collections

Crate collections 

Source
Expand description

Generic traits for working with heap-allocated, allocator-aware and fixed-capacity collection types.

CollectionBase is the constructor-free root for sequences, sets, maps and heaps. Collection and CollectionAlloc add constructors, CollectionBytes provides byte lengths for byte buffers, and CollectionCapacity provides fallible reservation and insertion. CollectionSet and CollectionMap add set and map operations, while CollectionEntry and MapEntry provide generic access to native map entry APIs.

The traits themselves need neither alloc nor a global allocator. The alloc feature (implied by the default std feature) adds the implementations for the collections of the alloc crate, and the heapless feature adds them for fixed-capacity collections which work on targets without a heap.

Re-exports§

pub extern crate alloc;
pub extern crate ascii;
pub extern crate hashbrown;
pub extern crate heapless;
pub extern crate indexmap;

Macros§

bmapalloc
Creates an allocated BTreeMap from key-value pairs.
bsetalloc
Creates an allocated BTreeSet from values.
dequealloc
Creates an allocated VecDeque from values, appending each value to the back of the deque.
heapalloc
Creates an allocated BinaryHeap from values.
listalloc
Creates an allocated LinkedList from values, appending each value to the end of the list.
mapalloc and std
Creates a HashMap from key-value pairs. Available with the std feature.
salloc
Converts a string literal into an allocated String.
setalloc and std
Creates a HashSet from values. Available with the std feature.

Structs§

FromSliceError
Error when slice size mismatches array length.

Traits§

ByteArray
Trait for fixed-size byte array types and wrappers around them.
Collection
Trait implemented by collections with a default constructor and iterator support.
CollectionAlloc
Trait implemented by collections that support custom allocators.
CollectionBase
Trait implemented by all collection types.
CollectionBytes
Trait for contiguous byte collections.
CollectionCapacity
Trait implemented by collections that can reserve storage capacity.
CollectionEntry
Trait implemented by maps that expose an in-place entry API.
CollectionMap
Trait implemented by key-value maps.
CollectionSet
Trait implemented by set collections.
MapEntry
Common interface over the native entry types of maps.