Expand description
A small, no_std/no_alloc-friendly memory allocation interface for managing raw buffers.
This crate provides explicit layouts, a split allocator trait stack, and structured errors.
It is no_std by default but relies on the alloc crate unless no_alloc is enabled. Enable
std for system allocator integrations and os_err_reporting for richer diagnostics.
§Core traits
Alloc,Dealloc,Grow,Shrink,Realloc- Convenience aliases:
BasicAllocandFullAlloc - Mutable variants in
alloc_mut:AllocMut,DeallocMut,GrowMut,ShrinkMut,ReallocMut,BasicAllocMut,FullAllocMut - Optional scoped allocations (
alloc_temp_traitfeature):AllocTemp
§Types and errors
Layout: crate layout type (with conversion to/fromStdLayoutunlessno_allocis enabled andstdisn’t)DefaultAlloc: default allocator wrapper that delegates to the global allocator- Errors:
Error,Cause,LayoutErr,ArithErr,ArithOp
§Data and type utilities
traits::data::type_props:SizedProps,PtrProps,VarSized,VarSizedStructtraits::data::marker:UnsizedCopy,Thin,SizeMetahelpers: alignment, checked arithmetic, and pointer helpers
§Allocator implementations
DefaultAlloc(available unlessno_allocis enabled andstdisn’t)Systemwhen thestdfeature is enabledCAllocbehind thec_allocfeatureStackAllocbehind thestack_allocfeature
§Feature flags
no_allocdisables usage of the rustalloccrate;stdcrate is used instead if thestdfeature is enabled.std: enablesstdintegration (includingSystem)os_err_reporting: best-effort OS error reporting viaerrno(requiresstd)alloc_temp_trait: scoped/temporary allocation traitc_alloc: Cposix_memalign-style allocator (allocs::c_alloc)stack_alloc:alloca-based allocator (allocs::stack_alloc)c_str: enablesCStr-specific data traits inno_std(MSRV: 1.64)metadata: enablescore::ptr::Pointeemetadata support on nightlysized_hierarchy: enablescore::marker::MetaSizedsupport on nightlyfull,full_nightly: convenience bundles
Modules§
- allocs
- Additional allocators which this crate supports.
- error
- Errors that can occur during allocation.
- ffi
- FFI backing any extra enabled allocators.
- helpers
- Helpers that tend to be useful in other libraries as well.
- layout
- A custom layout type to get around some strange Rust stdlib limitations.
- prelude
- A relatively minimal prelude containing the most common, important things from this crate.
- traits
- All traits provided by this crate.
Structs§
- Default
Alloc - Default allocator, delegating to the global allocator.