Module alloc

Module alloc 

Source
Expand description

Memory allocation APIs.

This crate’s Allocator, AllocError and Global resemble the types and traits from the nightly allocator api of the standard library (3528a5b 2025-05-11).

bump-scope provides compatibility with the allocator apis of:

  • the nightly standard library via the feature nightly-allocator-api
  • allocator_api2 version 0.2 via the feature allocator-api2-02
  • allocator_api2 version 0.3 via the feature allocator-api2-03

Bump and Bump(Scope) will implement those foreign Allocator traits when the respective feature is enabled. You can also use implementors of their Allocator trait as base allocators via the compat wrapper types.

You can convert between this crate’s AllocError and foreign one’s via the From and Into traits.

Modules§

compat
Contains wrappers that makes implementors of foreign Allocator traits implement this crate’s Allocator and vice versa.

Structs§

AllocError
The AllocError error indicates an allocation failure that may be due to resource exhaustion or to something wrong when combining the given input arguments with this allocator.
Globalalloc
The global memory allocator.

Traits§

Allocator
An implementation of Allocator can allocate, grow, shrink, and deallocate arbitrary blocks of data described via Layout.
BoxLike
A type that behaves like Box.