pub struct BorrowedMutPointer<'a, P, T: 'a> { /* private fields */ }Expand description
A pointer whose contents were borrowed from a Rust object, and therefore whose lifetime is limited to the lifetime of the underlying Rust object. The Rust object is borrowed from an exclusive reference, and therefore the pointer is mutable.
Implementations§
Source§impl<'a, P, T: 'a> BorrowedMutPointer<'a, P, T>
impl<'a, P, T: 'a> BorrowedMutPointer<'a, P, T>
Sourcepub unsafe fn new(ptr: *mut P, storage: T) -> Self
pub unsafe fn new(ptr: *mut P, storage: T) -> Self
Return a new BorrowedMutPointer that wraps the pointer ptr.
storage can contain any other data that ptr points to,
and that should be dropped when the BorrowedMutPointer goes out
of scope.
§Safety
The pointer must be valid for the lifetime of the BorrowedPointer.
If the pointer points into the storage, T must be pinned.
Sourcepub fn as_ptr(&self) -> *const P
pub fn as_ptr(&self) -> *const P
Return the pointer that is stored in the BorrowedMutPointer. The
returned pointer is constant and is valid for as long as the
BorrowedMutPointer itself.
Sourcepub fn as_mut_ptr(&mut self) -> *mut P
pub fn as_mut_ptr(&mut self) -> *mut P
Return the pointer that is stored in the BorrowedMutPointer. The
returned pointer is mutable and is valid for as long as the
BorrowedMutPointer itself.