pub struct Underalign<const N: usize, A: Allocator = Global>(pub A)
where
Align<N>: Alignment;Available on crate feature
alloc only.Expand description
Allocator that reduces alignment, similar to Misaligned.
Tuple Fields§
§0: ATrait Implementations§
Source§impl<const N: usize, A: Allocator> Allocator for Underalign<N, A>
impl<const N: usize, A: Allocator> Allocator for Underalign<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: Clone + Allocator> Clone for Underalign<N, A>
impl<const N: usize, A: Clone + Allocator> Clone for Underalign<N, A>
Source§fn clone(&self) -> Underalign<N, A>
fn clone(&self) -> Underalign<N, A>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const N: usize, A: Default + Allocator> Default for Underalign<N, A>
impl<const N: usize, A: Default + Allocator> Default for Underalign<N, A>
Source§fn default() -> Underalign<N, A>
fn default() -> Underalign<N, A>
Returns the “default value” for a type. Read more
Source§impl<const N: usize, A: Ord + Allocator> Ord for Underalign<N, A>
impl<const N: usize, A: Ord + Allocator> Ord for Underalign<N, A>
Source§fn cmp(&self, other: &Underalign<N, A>) -> Ordering
fn cmp(&self, other: &Underalign<N, A>) -> Ordering
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 Underalign<N, A>
impl<const N: usize, A: PartialOrd + Allocator> PartialOrd for Underalign<N, A>
impl<const N: usize, A: Copy + Allocator> Copy for Underalign<N, A>
impl<const N: usize, A: Eq + Allocator> Eq for Underalign<N, A>
impl<const N: usize, A: Allocator> StructuralPartialEq for Underalign<N, A>
Auto Trait Implementations§
impl<const N: usize, A> Freeze for Underalign<N, A>where
A: Freeze,
impl<const N: usize, A> RefUnwindSafe for Underalign<N, A>where
A: RefUnwindSafe,
impl<const N: usize, A> Send for Underalign<N, A>where
A: Send,
impl<const N: usize, A> Sync for Underalign<N, A>where
A: Sync,
impl<const N: usize, A> Unpin for Underalign<N, A>where
A: Unpin,
impl<const N: usize, A> UnwindSafe for Underalign<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