pub struct BorrowedRawAllocation<'a> {
pub(crate) base_ptr: NonNull<u8>,
pub(crate) size: usize,
pub(crate) phantom: PhantomData<&'a ()>,
}Expand description
Represents the unique borrow of a contiguous piece of a single allocation with some layout that is used as a data copying destination. May be wholly or partially uninitialized.
This type can only be obtained through the borrow_as_slab method on RawAllocation.
Fields§
§base_ptr: NonNull<u8>§size: usize§phantom: PhantomData<&'a ()>Trait Implementations§
Source§impl<'a> Slab for BorrowedRawAllocation<'a>
impl<'a> Slab for BorrowedRawAllocation<'a>
Source§fn base_ptr(&self) -> *const u8
fn base_ptr(&self) -> *const u8
Get a pointer to the beginning of the allocation represented by
self.Source§fn base_ptr_mut(&mut self) -> *mut u8
fn base_ptr_mut(&mut self) -> *mut u8
Get a pointer to the beginning of the allocation represented by
self.Source§fn as_maybe_uninit_bytes(&self) -> &[MaybeUninit<u8>]
fn as_maybe_uninit_bytes(&self) -> &[MaybeUninit<u8>]
Interpret a portion of
self as a slice of MaybeUninit<u8>. This is likely not
incredibly useful, you probably want to use Slab::as_maybe_uninit_bytes_mutSource§fn as_maybe_uninit_bytes_mut(&mut self) -> &mut [MaybeUninit<u8>]
fn as_maybe_uninit_bytes_mut(&mut self) -> &mut [MaybeUninit<u8>]
Interpret a portion of
self as a mutable slice of MaybeUninit<u8>.Source§unsafe fn assume_initialized_as_bytes(&self) -> &[u8]
unsafe fn assume_initialized_as_bytes(&self) -> &[u8]
Source§unsafe fn assume_initialized_as_bytes_mut(&mut self) -> &mut [u8]
unsafe fn assume_initialized_as_bytes_mut(&mut self) -> &mut [u8]
Interpret
self as a mutable byte slice. This assumes that all bytes
in self are initialized. Read moreSource§unsafe fn assume_range_initialized_as_bytes<R>(&self, range: R) -> &[u8]
unsafe fn assume_range_initialized_as_bytes<R>(&self, range: R) -> &[u8]
Interpret a range of
self as a byte slice. This assumes that all bytes
within range are initialized. Read moreSource§unsafe fn assume_range_initialized_as_bytes_mut<R>(
&mut self,
range: R,
) -> &mut [u8]
unsafe fn assume_range_initialized_as_bytes_mut<R>( &mut self, range: R, ) -> &mut [u8]
Interpret a range of
self as a mutable byte slice. This assumes that all bytes
within range are initialized. Read moreAuto Trait Implementations§
impl<'a> Freeze for BorrowedRawAllocation<'a>
impl<'a> RefUnwindSafe for BorrowedRawAllocation<'a>
impl<'a> !Send for BorrowedRawAllocation<'a>
impl<'a> !Sync for BorrowedRawAllocation<'a>
impl<'a> Unpin for BorrowedRawAllocation<'a>
impl<'a> UnsafeUnpin for BorrowedRawAllocation<'a>
impl<'a> UnwindSafe for BorrowedRawAllocation<'a>
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