Trait SpillAlloc

Source
pub trait SpillAlloc<'a>: Sized {
    type NewIn<A: 'a>;

    // Required method
    fn spill_alloc_in<A: Allocator + 'a>(self, alloc: A) -> Self::NewIn<A>;

    // Provided method
    fn spill_alloc(self) -> Self::NewIn<Global> { ... }
}
Expand description

Attach an allocator to a fixed allocation buffer. Once the initial buffer is exhausted, additional buffer(s) may be requested from the new allocator instance.

Required Associated Types§

Source

type NewIn<A: 'a>

The concrete type of resulting allocation target.

Required Methods§

Source

fn spill_alloc_in<A: Allocator + 'a>(self, alloc: A) -> Self::NewIn<A>

Consume the allocator instance, returning a new allocator which spills into the provided allocator instance alloc.

Provided Methods§

Source

fn spill_alloc(self) -> Self::NewIn<Global>

Consume the allocator instance, returning a new allocator which spills into the Global allocator.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, Z> SpillAlloc<'a> for &'a mut Zeroizing<Z>
where Z: Zeroize + 'a, &'a mut Z: SpillAlloc<'a>,

Source§

type NewIn<A: 'a> = <&'a mut Z as SpillAlloc<'a>>::NewIn<ZeroizingAlloc<A>>

Source§

fn spill_alloc_in<A: Allocator + 'a>(self, alloc: A) -> Self::NewIn<A>

Implementors§

Source§

impl<'a, T: 'a, const N: usize> SpillAlloc<'a> for &'a mut ArrayStorage<T, N>

Source§

type NewIn<A: 'a> = SpillStorage<'a, &'a mut [MaybeUninit<T>], A>

Source§

impl<'a, T: 'static, const N: usize> SpillAlloc<'a> for &'a mut ByteStorage<T, N>

Source§

type NewIn<A: 'a> = SpillStorage<'a, &'a mut ByteStorage<T, N>, A>