Skip to main content

Module alloc

Module alloc 

Source
Expand description

Low-level allocation and OOM-handling utilities.

Structs§

Vec
Like std::vec::Vec but all methods that allocate force handling allocation failure.

Enums§

BoxedSliceFromFallibleIterError
An error returned by new_boxed_slice_from_fallible_iter.
TooFewItemsOrOom
An error returned by new_boxed_slice_from_iter.

Traits§

PanicOnOom
An extension trait for ignoring OutOfMemory errors.
TryClone
A trait for values that can be cloned, but contain owned, heap-allocated values whose allocations may fail during cloning.
TryCollect
Extension trait for an Iterator to fallibly collect into a container.
TryExtend
Analogue of Extend except handles OOM conditions.
TryFromIterator
Analogue of FromIterator in the standard library, but used with TryCollect::try_collect instead.
TryNew
Extension trait providing fallible allocation for types like Arc<T> and Box<T>.

Functions§

boxed_slice_write_iter
Initialize a Box<[MaybeUninit<T>]> slice by writing the elements of the given iterator into it.
new_boxed_slice_from_fallible_iter
Create a Box<[T]> from the given iterator’s Result<T, E> items.
new_boxed_slice_from_iter
Create a Box<[T]> from the given iterator’s elements.
new_boxed_slice_from_iter_with_len
Create a Box<[T]> of length len from the given iterator’s elements.
new_uninit_boxed_slice
Allocate a new Box<[MaybeUninit<T>]> of the given length with uninitialized contents, returning Err(OutOfMemory) on allocation failure.
try_new
Helper function to invoke <T as TryNew>::try_new.