pub struct NodePtr<V: Variant> { /* private fields */ }Expand description
A wrapper around a node pointer.
Implementations§
Source§impl<V: Variant> NodePtr<V>
impl<V: Variant> NodePtr<V>
Sourcepub fn is_valid_for<M, P>(self, collection: &SelfRefCol<V, M, P>) -> bool
pub fn is_valid_for<M, P>(self, collection: &SelfRefCol<V, M, P>) -> bool
Returns true if:
collectionowns thisNodePtr, and- the node, or corresponding element of the
collection, that this pointer is pointing at is still active;
false otherwise.
It is safe to use the unsafe methods of NodePtr if is_valid_for(col)
returns true where col is the collection that the pointer is created from.
Sourcepub unsafe fn ptr(self) -> *const Node<V>
pub unsafe fn ptr(self) -> *const Node<V>
Returns the const raw pointer to the node.
§SAFETY
This method is unsafe as NodePtr implements Send and Sync.
It is safe dereference the received pointer if we know that is_valid_for(col) would
return true where col is the collection that this pointer is created from.
Sourcepub unsafe fn ptr_mut(self) -> *mut Node<V>
pub unsafe fn ptr_mut(self) -> *mut Node<V>
Returns the mutable raw pointer to the node.
§SAFETY
This method is unsafe as NodePtr implements Send and Sync.
It is safe dereference the received pointer if we know that is_valid_for(col) would
return true where col is the collection that this pointer is created from.
Trait Implementations§
impl<V: Variant> Copy for NodePtr<V>
impl<V: Variant> Send for NodePtr<V>
impl<V: Variant> Sync for NodePtr<V>
Auto Trait Implementations§
impl<V> Freeze for NodePtr<V>
impl<V> RefUnwindSafe for NodePtr<V>where
<V as Variant>::Prev: RefUnwindSafe,
<V as Variant>::Next: RefUnwindSafe,
<V as Variant>::Item: RefUnwindSafe,
impl<V> Unpin for NodePtr<V>
impl<V> UnwindSafe for NodePtr<V>where
<V as Variant>::Prev: RefUnwindSafe,
<V as Variant>::Next: RefUnwindSafe,
<V as Variant>::Item: RefUnwindSafe,
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