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 - Optional mutable variants (
alloc_mut_traits):AllocMut,DeallocMut,GrowMut,ShrinkMut,ReallocMut,BasicAllocMut,FullAllocMut - Optional scoped allocations (
alloc_temp_trait):AllocTemp
§Types and errors
Layout: crate layout type (with conversion to/fromStdLayoutunlessno_allocis enabled)DefaultAlloc: default allocator wrapper that delegates to the global allocator- Errors: [
Error], [Cause], [LayoutErr], [ArithErr], [ArithOp]
§Data and type utilities
data::type_props:SizedProps,PtrProps,VarSized,VarSizedStructdata::marker:UnsizedCopy,Thin,SizeMetahelpers: alignment, checked arithmetic, and pointer helpers
§Allocator implementations
DefaultAlloc(available unlessno_allocis enabled)std::alloc::Systemwhen thestdfeature is enabledc_alloc::CAllocbehind thec_allocfeaturestack_alloc::StackAllocbehind thestack_allocfeature
§Feature flags
std: enablesstdintegration (includingstd::alloc::System)os_err_reporting: best-effort OS error reporting viaerrno(requiresstd)alloc_mut_traits: mutable allocator trait variantsalloc_temp_trait: scoped/temporary allocation traitc_alloc: Caligned_alloc-style allocator (c_alloc)stack_alloc:alloca-based allocator (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 for docs/tests
Re-exports§
pub use traits::*;
Modules§
- c_alloc
- An allocator which uses C’s
aligned_allocset of allocation functions. - error
- Errors that can occur during allocation.
- helpers
- Helpers that tend to be useful in other libraries as well.
- stack_
alloc - An allocator which uses C’s
alloca/_allocaallocation function. - traits
- The library’s main traits.
Structs§
- Default
Alloc - Default allocator, delegating to the global allocator.
- Layout
- The layout of a block of memory in the form of its size and alignment in bytes.
Type Aliases§
- StdLayout
- A type alias for
alloc::alloc::Layout.