Struct composable_allocators::stacked::Stacked
source · pub struct Stacked<P: Params> { /* private fields */ }Implementations§
source§impl Stacked<RtParams>
impl Stacked<RtParams>
pub const fn from_static_slice(buf: &'static mut [MaybeUninit<u8>]) -> Self
source§impl<const BUF_LEN: usize> Stacked<CtParams<BUF_LEN>>
impl<const BUF_LEN: usize> Stacked<CtParams<BUF_LEN>>
pub const fn from_static_array( buf: &'static mut [MaybeUninit<u8>; BUF_LEN] ) -> Self
source§impl<P: Params> Stacked<P>
impl<P: Params> Stacked<P>
sourcepub unsafe fn with_params<T>(
params: P,
buf_ptr: NonNull<MaybeUninit<u8>>,
f: impl for<'a> FnOnce(&'a Stacked<P>) -> T
) -> T
pub unsafe fn with_params<T>( params: P, buf_ptr: NonNull<MaybeUninit<u8>>, f: impl for<'a> FnOnce(&'a Stacked<P>) -> T ) -> T
§Safety
buf_ptr should be a valid unique pointer to a slice with params.buf_len() bytes length.
Arguments should satisfy
(isize::MAX as usize) - params.buf_len() >= buf_ptr as usize
Trait Implementations§
source§impl<P: Params> Allocator for Stacked<P>
impl<P: Params> Allocator for Stacked<P>
source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api)Attempts to allocate a block of memory. Read more
source§unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
🔬This is a nightly-only experimental API. (
allocator_api)Deallocates the memory referenced by
ptr. Read moresource§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>
🔬This is a nightly-only experimental API. (
allocator_api)Attempts to extend the memory block. Read more
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>
🔬This is a nightly-only experimental API. (
allocator_api)Behaves like
grow, but also ensures that the new contents are set to zero before being
returned. Read moresource§unsafe fn shrink(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn shrink( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout ) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api)Attempts to shrink the memory block. Read more
source§fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
🔬This is a nightly-only experimental API. (
allocator_api)Behaves like
allocate, but also ensures that the returned memory is zero-initialized. Read moresource§impl<P: Params> Fallbackable for Stacked<P>
impl<P: Params> Fallbackable for Stacked<P>
impl<P: Params> NonUnwinding for Stacked<P>
Auto Trait Implementations§
impl<P> !Freeze for Stacked<P>
impl<P> RefUnwindSafe for Stacked<P>where
P: RefUnwindSafe,
impl<P> Send for Stacked<P>where
P: Send,
impl<P> Sync for Stacked<P>where
P: Sync,
impl<P> Unpin for Stacked<P>where
P: Unpin,
impl<P> UnwindSafe for Stacked<P>where
P: UnwindSafe,
Blanket Implementations§
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