pub struct NodeIdx<V>where
V: Variant,{ /* private fields */ }
Expand description
A node index providing safe and constant time access to elements of the self referential collection.
Implementations§
Source§impl<V> NodeIdx<V>where
V: Variant,
impl<V> NodeIdx<V>where
V: Variant,
Sourcepub fn new(state: MemoryState, node_ptr: &NodePtr<V>) -> NodeIdx<V>
pub fn new(state: MemoryState, node_ptr: &NodePtr<V>) -> NodeIdx<V>
Creates a new index for the element at the given node_ptr
and the collection with the given state
.
Sourcepub fn is_in_state(&self, state: MemoryState) -> bool
pub fn is_in_state(&self, state: MemoryState) -> bool
Checks whether or not the state
of the index matches that of this index.
Sourcepub fn get_ptr(&self, collection_state: MemoryState) -> Option<*mut Node<V>>
pub fn get_ptr(&self, collection_state: MemoryState) -> Option<*mut Node<V>>
Returns the node pointer if the index is in the same state as the collection_state
,
None otherwise.
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 only if this index is valid for the given collection
.
A node index is valid iff it satisfies the following two conditions:
- It is created from the given
collection
. - Memory state of the
collection
has not changed since this index was created.
Trait Implementations§
Source§impl<'i, T, M, P> Index<&'i NodeIdx<Doubly<T>>> for List<Doubly<T>, M, P>
impl<'i, T, M, P> Index<&'i NodeIdx<Doubly<T>>> for List<Doubly<T>, M, P>
Source§impl<'i, T, M, P> Index<&'i NodeIdx<Doubly<T>>> for ListSlice<'_, Doubly<T>, M, P>
impl<'i, T, M, P> Index<&'i NodeIdx<Doubly<T>>> for ListSlice<'_, Doubly<T>, M, P>
Source§impl<'i, T, M, P> Index<&'i NodeIdx<Doubly<T>>> for ListSliceMut<'_, Doubly<T>, M, P>
impl<'i, T, M, P> Index<&'i NodeIdx<Doubly<T>>> for ListSliceMut<'_, Doubly<T>, M, P>
Source§impl<'i, T, M, P> Index<&'i NodeIdx<Singly<T>>> for List<Singly<T>, M, P>
impl<'i, T, M, P> Index<&'i NodeIdx<Singly<T>>> for List<Singly<T>, M, P>
Source§impl<'i, T, M, P> Index<&'i NodeIdx<Singly<T>>> for ListSlice<'_, Singly<T>, M, P>
impl<'i, T, M, P> Index<&'i NodeIdx<Singly<T>>> for ListSlice<'_, Singly<T>, M, P>
Source§impl<'i, T, M, P> Index<&'i NodeIdx<Singly<T>>> for ListSliceMut<'_, Singly<T>, M, P>
impl<'i, T, M, P> Index<&'i NodeIdx<Singly<T>>> for ListSliceMut<'_, Singly<T>, M, P>
impl<V> Copy for NodeIdx<V>
impl<V> Eq for NodeIdx<V>where
V: Variant,
Auto Trait Implementations§
impl<V> Freeze for NodeIdx<V>
impl<V> RefUnwindSafe for NodeIdx<V>where
<V as Variant>::Prev: RefUnwindSafe,
<V as Variant>::Next: RefUnwindSafe,
<V as Variant>::Item: RefUnwindSafe,
impl<V> !Send for NodeIdx<V>
impl<V> !Sync for NodeIdx<V>
impl<V> Unpin for NodeIdx<V>
impl<V> UnwindSafe for NodeIdx<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