pub struct TypedPtrUninit<'mem, T>(/* private fields */);Expand description
A pointer to an uninitialized value with a lifetime.
Implementations§
Source§impl<'mem, T> TypedPtrUninit<'mem, T>
impl<'mem, T> TypedPtrUninit<'mem, T>
Sourcepub fn new(ptr: *mut T) -> Self
pub fn new(ptr: *mut T) -> Self
Create a new opaque pointer from a mutable pointer
This is safe because it’s generic over T
Sourcepub unsafe fn put(self, value: T) -> &'mem mut T
pub unsafe fn put(self, value: T) -> &'mem mut T
Write a value to this location and convert to an initialized pointer
§Safety
The pointer must be properly aligned for T and point to allocated memory that can be safely written to.
Sourcepub unsafe fn assume_init(self) -> &'mem mut T
pub unsafe fn assume_init(self) -> &'mem mut T
Assumes the pointer is initialized and returns an Opaque pointer
§Safety
The pointer must actually be pointing to initialized memory of the correct type.
Sourcepub unsafe fn field_uninit_at<U>(
&mut self,
offset: usize,
) -> TypedPtrUninit<'mem, U>
pub unsafe fn field_uninit_at<U>( &mut self, offset: usize, ) -> TypedPtrUninit<'mem, U>
Returns a pointer with the given offset added
§Safety
Offset is within the bounds of the allocated memory and U is the correct type for the field.
Trait Implementations§
Source§impl<'mem, T: Debug> Debug for TypedPtrUninit<'mem, T>
impl<'mem, T: Debug> Debug for TypedPtrUninit<'mem, T>
Source§impl<'mem, T> From<TypedPtrUninit<'mem, T>> for PtrUninit<'mem>
impl<'mem, T> From<TypedPtrUninit<'mem, T>> for PtrUninit<'mem>
Source§fn from(ptr: TypedPtrUninit<'mem, T>) -> Self
fn from(ptr: TypedPtrUninit<'mem, T>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'mem, T> Freeze for TypedPtrUninit<'mem, T>
impl<'mem, T> RefUnwindSafe for TypedPtrUninit<'mem, T>where
T: RefUnwindSafe,
impl<'mem, T> !Send for TypedPtrUninit<'mem, T>
impl<'mem, T> !Sync for TypedPtrUninit<'mem, T>
impl<'mem, T> Unpin for TypedPtrUninit<'mem, T>
impl<'mem, T> !UnwindSafe for TypedPtrUninit<'mem, T>
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