pub trait NodeRefs<'a, V, T>: Default + Clone
where V: Variant<'a, T>,
{ type References; // Required methods fn new(references: Self::References) -> Self; fn get(&self) -> &Self::References; fn get_mut(&mut self) -> &mut Self::References; fn update_reference( &mut self, prior_reference: &'a Node<'a, V, T>, new_reference: &'a Node<'a, V, T> ); fn referenced_nodes(&self) -> impl Iterator<Item = &'a Node<'a, V, T>> where V: 'a, T: 'a; // Provided method fn empty() -> Self { ... } }
Expand description

Trait defining how the references of a self referential collection node will be stored.

Required Associated Types§

source

type References

Type of the underlying references.

Required Methods§

source

fn new(references: Self::References) -> Self

Creates a new node references for the given references.

source

fn get(&self) -> &Self::References

Returns a reference to the underlying references.

source

fn get_mut(&mut self) -> &mut Self::References

Returns a mutable reference to the underlying references.

source

fn update_reference( &mut self, prior_reference: &'a Node<'a, V, T>, new_reference: &'a Node<'a, V, T> )

Updates this reference so that all internal references to the prior_reference are updated as new_reference. Does nothing if this NodeRefs does not hold a reference to the prior_reference.

source

fn referenced_nodes(&self) -> impl Iterator<Item = &'a Node<'a, V, T>>
where V: 'a, T: 'a,

Returns an iterator to the referenced nodes.

Provided Methods§

source

fn empty() -> Self

Creates empty references.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, V, T> NodeRefs<'a, V, T> for NodeRefNone
where V: Variant<'a, T>,

source§

impl<'a, V, T> NodeRefs<'a, V, T> for NodeRefSingle<'a, V, T>
where V: Variant<'a, T>,

§

type References = Option<&'a Node<'a, V, T>>

source§

impl<'a, V, T> NodeRefs<'a, V, T> for NodeRefsVec<'a, V, T>
where V: Variant<'a, T>,

§

type References = Vec<&'a Node<'a, V, T>>

source§

impl<'a, const N: usize, V, T> NodeRefs<'a, V, T> for NodeRefsArray<'a, N, V, T>
where V: Variant<'a, T>,

§

type References = [Option<&'a Node<'a, V, T>>; N]