Struct NodeCollection

Source
pub struct NodeCollection<T: Debug + Clone> {
    pub nodes: Vec<Node<T>>,
}
Expand description

NodeCollection represents a Vec of Nodes. Usually retrived by collecting over a Node linked list using the CollectNode trait implementation. WARNING: this is not a linked list, but simply a collection of unrelated nodes. The contained nodes might come from separated linked lists or from the same one.

Fields§

§nodes: Vec<Node<T>>

Implementations§

Source§

impl<T: Debug + Clone> NodeCollection<T>

Source

pub fn from_vec(nodes: Vec<Node<T>>) -> Self

Builds a new collection with the vector provided.

Source

pub fn new() -> Self

Source

pub fn into_nodes(self) -> Vec<Node<T>>

Consume self and retrive its Nodes.

Source

pub fn as_nodes(&self) -> &Vec<Node<T>>

Retrive a reference to the Nodes.

Source

pub fn as_mut_nodes(&mut self) -> &mut Vec<Node<T>>

Retrive a mutable reference to the Nodes.

Source

pub fn push(&mut self, node: Node<T>)

Push a node to the collection.

Source

pub fn free(&self)

Re-set the parent, prev and next pointers in every node of the collection. This function is commonly used when iterating over a linked list detaching the nodes satisfying an identifier using HedelDetach::detach_preserve. refer to HedelDetach::detach_preserve for a code example.

WARNING: don’t use this function to detach a node from a linked list.

Trait Implementations§

Source§

impl<T: Debug + Clone> IntoIterator for NodeCollection<T>

Source§

type Item = Node<T>

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<Node<T>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<T> Freeze for NodeCollection<T>

§

impl<T> !RefUnwindSafe for NodeCollection<T>

§

impl<T> !Send for NodeCollection<T>

§

impl<T> !Sync for NodeCollection<T>

§

impl<T> Unpin for NodeCollection<T>

§

impl<T> !UnwindSafe for NodeCollection<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.