pub struct PtrConstWide<'mem> { /* private fields */ }
Expand description
A type-erased, read-only wide pointer to an initialized value.
Like PtrConst
, but for unsized types where metadata is needed. Cannot be null
(but may be dangling for ZSTs). The lifetime 'mem
represents the borrow of the
underlying memory, which must remain valid and initialized.
Implementations§
Source§impl<'mem> PtrConstWide<'mem>
impl<'mem> PtrConstWide<'mem>
Sourcepub fn as_byte_ptr(self) -> *const u8
pub fn as_byte_ptr(self) -> *const u8
Returns the underlying data pointer as a pointer to u8
(the address of the object).
Sourcepub unsafe fn get<T: ?Sized>(self) -> &'mem T
pub unsafe fn get<T: ?Sized>(self) -> &'mem T
Borrows the underlying object as a reference of type T
.
§Safety
T
must be the actual underlying (potentially unsized) type of the pointed-to memory.- The memory must remain valid and not be mutated while this reference exists.
- The pointer must be correctly aligned and point to a valid, initialized value for type
T
.
Trait Implementations§
Source§impl<'mem> Clone for PtrConstWide<'mem>
impl<'mem> Clone for PtrConstWide<'mem>
Source§fn clone(&self) -> PtrConstWide<'mem>
fn clone(&self) -> PtrConstWide<'mem>
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<'a> From<PtrConstWide<'a>> for GenericPtr<'a>
impl<'a> From<PtrConstWide<'a>> for GenericPtr<'a>
Source§fn from(value: PtrConstWide<'a>) -> Self
fn from(value: PtrConstWide<'a>) -> Self
Converts to this type from the input type.
impl<'mem> Copy for PtrConstWide<'mem>
Auto Trait Implementations§
impl<'mem> Freeze for PtrConstWide<'mem>
impl<'mem> RefUnwindSafe for PtrConstWide<'mem>
impl<'mem> !Send for PtrConstWide<'mem>
impl<'mem> !Sync for PtrConstWide<'mem>
impl<'mem> Unpin for PtrConstWide<'mem>
impl<'mem> UnwindSafe for PtrConstWide<'mem>
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