pub struct RefsVec<V>(/* private fields */)
where
V: Variant;
Expand description
A dynamic number of references.
Implementations§
Source§impl<V: Variant> RefsVec<V>
impl<V: Variant> RefsVec<V>
Sourcepub fn get(&self, i: usize) -> Option<&NodePtr<V>>
pub fn get(&self, i: usize) -> Option<&NodePtr<V>>
Returns the i-th node pointer; None if out of bounds.
Sourcepub fn iter(&self) -> Iter<'_, NodePtr<V>>
pub fn iter(&self) -> Iter<'_, NodePtr<V>>
Creates an iterator over node pointers of the references collection.
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, NodePtr<V>>
pub fn iter_mut(&mut self) -> IterMut<'_, NodePtr<V>>
Creates a mutable iterator over node pointers of the references collection.
Sourcepub fn push(&mut self, node_ptr: NodePtr<V>)
pub fn push(&mut self, node_ptr: NodePtr<V>)
Pushes the node references to the end of the references collection.
Sourcepub fn insert(&mut self, position: usize, node_ptr: NodePtr<V>)
pub fn insert(&mut self, position: usize, node_ptr: NodePtr<V>)
Inserts the reference with the given node_ptr
to the given position
of the references collection.
Sourcepub fn push_before(
&mut self,
pivot_ptr: &NodePtr<V>,
node_ptr: NodePtr<V>,
) -> Option<usize>
pub fn push_before( &mut self, pivot_ptr: &NodePtr<V>, node_ptr: NodePtr<V>, ) -> Option<usize>
Inserts the reference with the given node_ptr
just before the given pivot_ptr
the reference if it exists;
and returns the position that the new reference is inserted to.
Does nothing leaving the children unchanged if the pivot_ptr
reference does not exists, and returns None.
Sourcepub fn push_after(
&mut self,
pivot_ptr: &NodePtr<V>,
node_ptr: NodePtr<V>,
) -> Option<usize>
pub fn push_after( &mut self, pivot_ptr: &NodePtr<V>, node_ptr: NodePtr<V>, ) -> Option<usize>
Inserts the reference with the given node_ptr
just after the given pivot_ptr
the reference if it exists;
and returns the position that the new reference is inserted to.
Does nothing leaving the children unchanged if the pivot_ptr
reference does not exists, and returns None.