pub struct CoreCol<V, P>{ /* private fields */ }
Expand description
Core collection of the self referential collection.
Implementations§
Source§impl<V, P> CoreCol<V, P>
impl<V, P> CoreCol<V, P>
Sourcepub fn into_inner(self) -> (P, V::Ends, usize)
pub fn into_inner(self) -> (P, V::Ends, usize)
Destructs the collection into its inner pinned vec, ends and length.
Sourcepub fn utilization(&self) -> Utilization
pub fn utilization(&self) -> Utilization
Returns current node utilization of the collection.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns whether or not the self referential collection is empty.
Sourcepub fn node(&self, node_ptr: &NodePtr<V>) -> &Node<V>
pub fn node(&self, node_ptr: &NodePtr<V>) -> &Node<V>
Returns a reference to the node with the given node_ptr
.
Sourcepub fn position_of(&self, node_ptr: &NodePtr<V>) -> Option<usize>
pub fn position_of(&self, node_ptr: &NodePtr<V>) -> Option<usize>
Returns the position of the node with the given node_ptr
,
None if the pointer is not valid.
Sourcepub fn position_of_unchecked(&self, node_ptr: &NodePtr<V>) -> usize
pub fn position_of_unchecked(&self, node_ptr: &NodePtr<V>) -> usize
Returns the position of the node with the given node_ptr
.
§Panics
Panics if the pointer is not valid.
Sourcepub unsafe fn data_unchecked(&self, node_ptr: &NodePtr<V>) -> &V::Item
pub unsafe fn data_unchecked(&self, node_ptr: &NodePtr<V>) -> &V::Item
Sourcepub fn node_ptr_at_pos(&self, node_position: usize) -> NodePtr<V>
pub fn node_ptr_at_pos(&self, node_position: usize) -> NodePtr<V>
Returns the pointer of the element with the given node_position
in the underlying nodes storage.
§Panics
Panics if the node_position
is out of bounds.
Sourcepub fn nodes_mut(&mut self) -> &mut P
pub fn nodes_mut(&mut self) -> &mut P
Returns a mutable reference to the underlying nodes storage.
Sourcepub fn push(&mut self, data: V::Item) -> NodePtr<V>
pub fn push(&mut self, data: V::Item) -> NodePtr<V>
Pushes the element with the given data
and returns its pointer.
Sourcepub unsafe fn data_mut_unchecked(
&mut self,
node_ptr: &NodePtr<V>,
) -> &mut V::Item
pub unsafe fn data_mut_unchecked( &mut self, node_ptr: &NodePtr<V>, ) -> &mut V::Item
Sourcepub fn close(&mut self, node_ptr: &NodePtr<V>) -> V::Item
pub fn close(&mut self, node_ptr: &NodePtr<V>) -> V::Item
Closes the node at the given node_ptr
and returns its data.
§Panics
Panics if the node was already closed.
Sourcepub fn close_if_active(&mut self, node_ptr: &NodePtr<V>) -> Option<V::Item>
pub fn close_if_active(&mut self, node_ptr: &NodePtr<V>) -> Option<V::Item>
Closes the node at the given node_ptr
and returns its data the node was active.
Does nothing and returns None if the node was already closed.
Sourcepub fn ends_mut(&mut self) -> &mut V::Ends
pub fn ends_mut(&mut self) -> &mut V::Ends
Returns a mutable reference to the ends of the collection.
Sourcepub fn node_mut(&mut self, node_ptr: &NodePtr<V>) -> &mut Node<V>
pub fn node_mut(&mut self, node_ptr: &NodePtr<V>) -> &mut Node<V>
Returns a mutable reference to the node with the given node_ptr
.