pub struct Align<const ALIGN: usize, A = Global> { /* private fields */ }
Expand description
Allocator that forces all allocations to be aligned
to at least ALIGN
bytes.
Implementations§
Trait Implementations§
Source§impl<const ALIGN: usize, A> Allocator for Align<ALIGN, A>where
A: Allocator,
impl<const ALIGN: usize, A> Allocator for Align<ALIGN, A>where
A: Allocator,
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§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§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 moreAuto Trait Implementations§
impl<const ALIGN: usize, A> Freeze for Align<ALIGN, A>where
A: Freeze,
impl<const ALIGN: usize, A> RefUnwindSafe for Align<ALIGN, A>where
A: RefUnwindSafe,
impl<const ALIGN: usize, A> Send for Align<ALIGN, A>where
A: Send,
impl<const ALIGN: usize, A> Sync for Align<ALIGN, A>where
A: Sync,
impl<const ALIGN: usize, A> Unpin for Align<ALIGN, A>where
A: Unpin,
impl<const ALIGN: usize, A> UnwindSafe for Align<ALIGN, A>where
A: 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