Struct orx_selfref_col::CoreCol
source · 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.
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 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
.