#[repr(C)]
pub union ByteStorage<T, const N: usize> {
/* private fields */
}
Expand description
A reusable storage buffer consisting of an array of bytes.
Implementations§
Source§impl<T, const N: usize> ByteStorage<T, N>
impl<T, const N: usize> ByteStorage<T, N>
Sourcepub fn as_uninit_slice(&mut self) -> &mut [MaybeUninit<u8>]
pub fn as_uninit_slice(&mut self) -> &mut [MaybeUninit<u8>]
Access the buffer contents as a mutable slice.
Trait Implementations§
Source§impl<'a, T, const N: usize> AllocateIn for &'a mut ByteStorage<T, N>
impl<'a, T, const N: usize> AllocateIn for &'a mut ByteStorage<T, N>
Source§fn allocate_in(
self,
layout: Layout,
) -> Result<(NonNull<[u8]>, Self::Alloc), AllocError>
fn allocate_in( self, layout: Layout, ) -> Result<(NonNull<[u8]>, Self::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]>, Self::Alloc), AllocError>
fn allocate_zeroed_in( self, layout: Layout, ) -> Result<(NonNull<[u8]>, Self::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, const N: usize> ConstDefault for ByteStorage<T, N>
impl<T, const N: usize> ConstDefault for ByteStorage<T, N>
Source§impl<T, const N: usize> Debug for ByteStorage<T, N>
impl<T, const N: usize> Debug for ByteStorage<T, N>
Source§impl<T, const N: usize> Default for ByteStorage<T, N>
impl<T, const N: usize> Default for ByteStorage<T, N>
Source§impl<'a, T: 'static, const N: usize> SpillAlloc<'a> for &'a mut ByteStorage<T, N>
impl<'a, T: 'static, const N: usize> SpillAlloc<'a> for &'a mut ByteStorage<T, N>
Source§type NewIn<A: 'a> = SpillStorage<'a, &'a mut ByteStorage<T, N>, A>
type NewIn<A: 'a> = SpillStorage<'a, &'a mut ByteStorage<T, N>, A>
The concrete type of resulting allocation target.
Source§fn spill_alloc_in<A: Allocator + 'a>(self, alloc: A) -> Self::NewIn<A>
fn spill_alloc_in<A: Allocator + 'a>(self, alloc: A) -> Self::NewIn<A>
Consume the allocator instance, returning a new allocator
which spills into the provided allocator instance
alloc
.Source§fn spill_alloc(self) -> Self::NewIn<Global>
fn spill_alloc(self) -> Self::NewIn<Global>
Consume the allocator instance, returning a new allocator
which spills into the Global allocator.
Auto Trait Implementations§
impl<T, const N: usize> Freeze for ByteStorage<T, N>where
T: Freeze,
impl<T, const N: usize> RefUnwindSafe for ByteStorage<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for ByteStorage<T, N>where
T: Send,
impl<T, const N: usize> Sync for ByteStorage<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for ByteStorage<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for ByteStorage<T, N>where
T: 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