pub struct Node<V>where
V: Variant,{ /* private fields */ }
Expand description
Node of the self referential collection.
Implementations§
Source§impl<V> Node<V>where
V: Variant,
impl<V> Node<V>where
V: Variant,
Sourcepub fn new_active(data: V::Item, prev: V::Prev, next: V::Next) -> Self
pub fn new_active(data: V::Item, prev: V::Prev, next: V::Next) -> Self
Creates a new active node with the given data
, and prev
and next
references.
Sourcepub fn new_free_node(data: V::Item) -> Self
pub fn new_free_node(data: V::Item) -> Self
Creates a new active node with the given data
but with no connections.
Sourcepub fn into_data(self) -> Option<V::Item>
pub fn into_data(self) -> Option<V::Item>
Takes and returns the data of the node, transitions the node into the closed state.
Sourcepub fn data(&self) -> Option<&V::Item>
pub fn data(&self) -> Option<&V::Item>
Returns a reference to the data of the node; None if the node is already closed.
Sourcepub fn data_mut(&mut self) -> Option<&mut V::Item>
pub fn data_mut(&mut self) -> Option<&mut V::Item>
Returns a mutable reference to the underlying data.
Sourcepub fn prev_mut(&mut self) -> &mut V::Prev
pub fn prev_mut(&mut self) -> &mut V::Prev
Returns a mutable reference to the previous references.
Sourcepub fn close(&mut self) -> V::Item
pub fn close(&mut self) -> V::Item
Closes the node and returns its data, and clears its connections.
§Panics
Panics if the node was already closed.
Trait Implementations§
Auto Trait Implementations§
impl<V> Freeze for Node<V>
impl<V> RefUnwindSafe for Node<V>where
<V as Variant>::Prev: RefUnwindSafe,
<V as Variant>::Next: RefUnwindSafe,
<V as Variant>::Item: RefUnwindSafe,
impl<V> Send for Node<V>
impl<V> Sync for Node<V>
impl<V> Unpin for Node<V>
impl<V> UnwindSafe for Node<V>where
<V as Variant>::Prev: UnwindSafe,
<V as Variant>::Next: UnwindSafe,
<V as Variant>::Item: UnwindSafe,
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