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>
impl<A: Allocator> Allocator for Spill<'_, A>
Source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
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)
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>
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>
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>
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§impl<'a, A: AllocatorDefault> AllocatorDefault for Spill<'a, A>
impl<'a, A: AllocatorDefault> AllocatorDefault for Spill<'a, A>
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 Awhere
A: Allocator,
impl<A> AllocateIn for Awhere
A: Allocator,
Source§fn allocate_in(
self,
layout: Layout,
) -> Result<(NonNull<[u8]>, <A as AllocateIn>::Alloc), AllocError>
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 instanceSource§fn allocate_zeroed_in(
self,
layout: Layout,
) -> Result<(NonNull<[u8]>, <A as AllocateIn>::Alloc), AllocError>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T, A> ToOwnedIn<A> for T
impl<T, A> ToOwnedIn<A> for T
Source§fn try_to_owned_in<I>(
&self,
_alloc_in: I,
) -> Result<<T as ToOwnedIn<A>>::Owned, StorageError>where
I: AllocateIn<Alloc = A>,
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::Ownedwhere
I: AllocateIn<Alloc = A>,
fn to_owned_in<I>(&self, alloc_in: I) -> Self::Ownedwhere
I: AllocateIn<Alloc = A>,
Create an owned copy of this instance in a given allocation target.
Source§impl<T, A> VecConfigAlloc<T> for Awhere
A: Allocator,
impl<T, A> VecConfigAlloc<T> for Awhere
A: Allocator,
Source§fn allocator(
buf: &<A as VecConfig>::Buffer<T>,
) -> &<A as VecConfigAlloc<T>>::Alloc
fn allocator( buf: &<A as VecConfig>::Buffer<T>, ) -> &<A as VecConfigAlloc<T>>::Alloc
Get a reference to the allocator instance.
Source§impl<T, A> VecConfigNew<T> for Awhere
A: AllocatorDefault,
impl<T, A> VecConfigNew<T> for Awhere
A: AllocatorDefault,
Source§const EMPTY_BUFFER: <A as VecConfig>::Buffer<T> = const EMPTY_BUFFER: Self::Buffer<T> =
FatBuffer<T, VecHeader<usize>, A>::DEFAULT;
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>
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
impl<T, A> VecConfigSpawn<T> for A
Source§impl<T, C> VecNewIn<T> for Cwhere
C: AllocateIn,
impl<T, C> VecNewIn<T> for Cwhere
C: AllocateIn,
Source§type Config = <C as AllocateIn>::Alloc
type Config = <C as AllocateIn>::Alloc
The associated
Vec
configuration type.