flex_alloc::alloc

Struct Spill

Source
pub struct Spill<'a, A> { /* private fields */ }
Expand description

An allocator which may represent either a fixed allocation or a dynamic allocation with an allocator instance A.

Trait Implementations§

Source§

impl<A: Allocator> Allocator for Spill<'_, A>

Source§

fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>

Try to allocate a slice of memory within this allocator instance, returning the new allocation.
Source§

unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)

Release an allocation produced by this allocator. Read more
Source§

fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>

Try to allocate a slice of memory within this allocator instance, returning the new allocation. The memory will be initialized with zeroes.
Source§

unsafe fn grow( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>

Try to extend the size of an allocation to accomodate a new, larger layout.
Source§

unsafe fn grow_zeroed( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>

Try to extend the size of an allocation to accomodate a new, larger layout. Fill the extra capacity with zeros.
Source§

unsafe fn shrink( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>

Try to reduce the size of an allocation to accomodate a new, smaller layout.
Source§

fn by_ref(&self) -> &Self
where Self: Sized,

Obtain a reference to this allocator type.
Source§

impl<'a, A: AllocatorDefault> AllocatorDefault for Spill<'a, A>

Source§

const DEFAULT: Self = _

The constant initializer for this allocator.
Source§

impl<'a, A: Default + Allocator> Clone for Spill<'a, A>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, A: Debug> Debug for Spill<'a, A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A: Default + Allocator> Default for Spill<'_, A>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a, A> Freeze for Spill<'a, A>
where A: Freeze,

§

impl<'a, A> RefUnwindSafe for Spill<'a, A>
where A: RefUnwindSafe,

§

impl<'a, A> !Send for Spill<'a, A>

§

impl<'a, A> !Sync for Spill<'a, A>

§

impl<'a, A> Unpin for Spill<'a, A>
where A: Unpin,

§

impl<'a, A> !UnwindSafe for Spill<'a, A>

Blanket Implementations§

Source§

impl<A> AllocateIn for A
where A: Allocator,

Source§

type Alloc = A

The type of the allocator instance
Source§

fn allocate_in( self, layout: Layout, ) -> Result<(NonNull<[u8]>, <A as AllocateIn>::Alloc), AllocError>

Try to allocate a slice of a memory corresponding to layout, returning the new allocation and the allocator instance
Source§

fn allocate_zeroed_in( self, layout: Layout, ) -> Result<(NonNull<[u8]>, <A as AllocateIn>::Alloc), AllocError>

Try to allocate a slice of a memory corresponding to layout, returning the new allocation and the allocator instance. The memory will be initialized with zeroes.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, A> ToOwnedIn<A> for T
where T: Clone + 'static, A: Allocator,

Source§

type Owned = T

The owned representation of this type.
Source§

fn try_to_owned_in<I>( &self, _alloc_in: I, ) -> Result<<T as ToOwnedIn<A>>::Owned, StorageError>
where I: AllocateIn<Alloc = A>,

To to create an owned copy of this instance in a given allocation target.
Source§

fn to_owned_in<I>(&self, alloc_in: I) -> Self::Owned
where I: AllocateIn<Alloc = A>,

Create an owned copy of this instance in a given allocation target.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<A> VecConfig for A
where A: Allocator,

Source§

type Buffer<T> = FatBuffer<T, VecHeader, A>

The internal buffer type.
Source§

type Grow = GrowDoubling

The growth strategy.
Source§

type Index = usize

The index type used to define the capacity and length.
Source§

impl<T, A> VecConfigAlloc<T> for A
where A: Allocator,

Source§

type Alloc = A

The allocator instance type.
Source§

fn allocator( buf: &<A as VecConfig>::Buffer<T>, ) -> &<A as VecConfigAlloc<T>>::Alloc

Get a reference to the allocator instance.
Source§

fn buffer_from_parts( data: NonNull<T>, length: <A as VecConfig>::Index, capacity: <A as VecConfig>::Index, alloc: <A as VecConfigAlloc<T>>::Alloc, ) -> <A as VecConfig>::Buffer<T>

Create a Vec buffer instance from its constituent parts.
Source§

fn buffer_into_parts( buffer: <A as VecConfig>::Buffer<T>, ) -> (NonNull<T>, <A as VecConfig>::Index, <A as VecConfig>::Index, <A as VecConfigAlloc<T>>::Alloc)

Disassemble a Vec buffer instance into its constituent parts.
Source§

impl<T, A> VecConfigNew<T> for A

Source§

const EMPTY_BUFFER: <A as VecConfig>::Buffer<T> = const EMPTY_BUFFER: Self::Buffer<T> = FatBuffer<T, VecHeader<usize>, A>::DEFAULT;

Constant initializer for an empty buffer.
Source§

fn buffer_try_new( capacity: <A as VecConfig>::Index, exact: bool, ) -> Result<<A as VecConfig>::Buffer<T>, StorageError>

Try to create a new buffer instance with a given capacity.
Source§

impl<T, A> VecConfigSpawn<T> for A
where A: Allocator + Clone,

Source§

fn buffer_try_spawn( buf: &<A as VecConfig>::Buffer<T>, capacity: <A as VecConfig>::Index, exact: bool, ) -> Result<<A as VecConfig>::Buffer<T>, StorageError>

Try to create a new buffer instance with a given capacity.
Source§

impl<T, C> VecNewIn<T> for C
where C: AllocateIn,

Source§

type Config = <C as AllocateIn>::Alloc

The associated Vec configuration type.
Source§

fn buffer_try_new_in( self, capacity: <<C as VecNewIn<T>>::Config as VecConfig>::Index, exact: bool, ) -> Result<<<C as VecNewIn<T>>::Config as VecConfig>::Buffer<T>, StorageError>

Try to create a new buffer given an allocation target.