Expand description
Allocator-aware Box, Vec, Arc, HashMap and the TalcAlloc
bridge — re-exported through a single workspace façade.
§Why this crate exists
Stable Rust gives us 2-parameter Box<T> / Vec<T> / Arc<T>
(defaulting to the global allocator), but the 3-parameter forms
with a custom allocator are nightly-only. We want allocator-generic
types so the shared talc-managed cache region can own everything
(caps, refcounts, map storage) instead of half-talc-half-global.
The fix is allocator-api2 0.2 + talc 4.x + hashbrown 0.17
(with their allocator / allocator-api2 features). All three
agree on a single Allocator trait —
allocator_api2::alloc::Allocator — and Box / Vec / HashMap are
all allocator-aware on stable. The only thing api2 doesn’t ship is
an Arc, so we provide one in sync.
Downstream depends on allocate only — no api2, talc, hashbrown,
or spinning_top entries in any other crate’s Cargo.toml.
§Module layout
Module paths mirror alloc:: where it makes sense:
boxed::Box<T, A>— re-export ofallocator_api2::boxed::Box.vec::Vec<T, A>— re-export ofallocator_api2::vec::Vec.collections::HashMap<K, V, A>— type-alias overhashbrown::HashMapwith the default hasher.sync::Arc<T, A>— own non-intrusiveArc(heap-header refcount, mirrors stdArc’s API).talc—TalcAlloc/CacheTalcLock/ talc re-exports.
Plus, at the crate root:
Allocator,Global,AllocError,Layout— re-exports ofallocator_api2::alloc::*.
Modules§
- boxed
- Re-export of
allocator_api2::boxed::Box. - collections
- Allocator-aware collections.
- sync
Arc<T, A>— atomically reference-counted handle backed byA.- talc
- Talc allocator integration.
- vec
- Re-export of
allocator_api2::vec::Vec.
Structs§
- Alloc
Error - The
AllocErrorerror indicates an allocation failure that may be due to resource exhaustion or to something wrong when combining the given input arguments with this allocator. - Global
- The global memory allocator.
- Layout
- Layout of a block of memory.