pub struct CompactPtrMut<T: CompactRepr> { /* private fields */ }Implementations§
Source§impl<T: CompactRepr> CompactPtrMut<T>
impl<T: CompactRepr> CompactPtrMut<T>
pub fn is_null(self) -> bool
Sourcepub unsafe fn as_ref(self) -> Option<Compact<T>>
pub unsafe fn as_ref(self) -> Option<Compact<T>>
Returns the element the pointer references, or None if it is null.
§Safety
If non-null, self.packed must point to valid Store<T> storage and
self.index must address an initialized element within it.
Sourcepub unsafe fn as_mut<'a>(self) -> Option<CompactRefMut<'a, T>>
pub unsafe fn as_mut<'a>(self) -> Option<CompactRefMut<'a, T>>
Returns a mutable reference to the element the pointer references, or
None if it is null.
§Safety
If non-null, self.packed must point to valid Store<T> storage (or,
for a direct pointer, to a live T), self.index must address an
initialized element within it, and the caller must ensure no other
references to the same element exist (no aliasing).
pub fn as_ptr(&self) -> CompactPtr<T>
Sourcepub unsafe fn offset(self, count: isize) -> CompactPtrMut<T>
pub unsafe fn offset(self, count: isize) -> CompactPtrMut<T>
Produces a pointer offset by count elements (analogous to
pointer::offset).
§Safety
The resulting index (self.index + count) must be in bounds or one
past the end of the same allocated backing storage.
Sourcepub unsafe fn add(self, count: usize) -> CompactPtrMut<T>
pub unsafe fn add(self, count: usize) -> CompactPtrMut<T>
Produces a pointer advanced by count elements (analogous to
pointer::add).
§Safety
The resulting index (self.index + count) must be in bounds or one
past the end of the same allocated backing storage.
Sourcepub unsafe fn sub(self, count: usize) -> CompactPtrMut<T>
pub unsafe fn sub(self, count: usize) -> CompactPtrMut<T>
Produces a pointer moved back by count elements (analogous to
pointer::sub).
§Safety
count must not exceed self.index; the resulting index must be in
bounds of the same allocated backing storage.
Sourcepub unsafe fn read(self) -> Compact<T>
pub unsafe fn read(self) -> Compact<T>
Reads the element the pointer references (analogous to
pointer::read).
§Safety
self.packed must point to valid Store<T> storage and self.index
must address an initialized element within it.
Sourcepub unsafe fn write(self, val: Compact<T>)
pub unsafe fn write(self, val: Compact<T>)
Overwrites the element the pointer references (analogous to
pointer::write).
§Safety
self.packed must point to valid Store<T> storage (or, for a direct
pointer, to a live, writable T), self.index must address a
writable element within it, and the caller must ensure no other
references to the same element exist (no aliasing).
Trait Implementations§
Source§impl<T: Clone + CompactRepr> Clone for CompactPtrMut<T>
impl<T: Clone + CompactRepr> Clone for CompactPtrMut<T>
Source§fn clone(&self) -> CompactPtrMut<T>
fn clone(&self) -> CompactPtrMut<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more