pub struct Overalign<const N: usize, A: Allocator = Global>(pub A)
where
Align<N>: Alignment;Available on crate feature
alloc only.Expand description
Allocator that forces minimum alignment, similar to Aligned.
Tuple Fields§
§0: ATrait Implementations§
Source§impl<const N: usize, A: Allocator> Allocator for Overalign<N, A>
impl<const N: usize, A: Allocator> Allocator for Overalign<N, A>
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 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§impl<const N: usize, A: Ord + Allocator> Ord for Overalign<N, A>
impl<const N: usize, A: Ord + Allocator> Ord for Overalign<N, A>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<const N: usize, A: PartialOrd + Allocator> PartialOrd for Overalign<N, A>
impl<const N: usize, A: PartialOrd + Allocator> PartialOrd for Overalign<N, A>
impl<const N: usize, A: Copy + Allocator> Copy for Overalign<N, A>
impl<const N: usize, A: Eq + Allocator> Eq for Overalign<N, A>
impl<const N: usize, A: Allocator> StructuralPartialEq for Overalign<N, A>
Auto Trait Implementations§
impl<const N: usize, A> Freeze for Overalign<N, A>where
A: Freeze,
impl<const N: usize, A> RefUnwindSafe for Overalign<N, A>where
A: RefUnwindSafe,
impl<const N: usize, A> Send for Overalign<N, A>where
A: Send,
impl<const N: usize, A> Sync for Overalign<N, A>where
A: Sync,
impl<const N: usize, A> Unpin for Overalign<N, A>where
A: Unpin,
impl<const N: usize, A> UnwindSafe for Overalign<N, 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