pub struct Node<T>{ /* private fields */ }Expand description
A node in a PinList.
This type is a state machine between three states:
- Initial: The initial state; the node is not registered in any list. This is the only state that can be dropped without aborting the process.
- Linked:
The node has been linked into a
PinList. It holds aProtectedand anUnprotected, of which the former can only be accessed when access to thePinListcan be proven. Dropping a node in this state will abort. - Removed:
The node has been removed from a
PinList. It holds aRemovedand anUnprotected. Similar to the “linked” state, proof of access to thePinListis required for most operations. Dropping a node in this state will abort.
Implementations§
Source§impl<T: ?Sized> Node<T>where
<T as ConstFnBounds>::Type: Types,
impl<T: ?Sized> Node<T>where
<T as ConstFnBounds>::Type: Types,
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create a new node in its initial state.
You can move this node into other states by functions like PinList::push_front.
Source§impl<T: ?Sized + Types> Node<T>
impl<T: ?Sized + Types> Node<T>
Sourcepub fn is_initial(&self) -> bool
pub fn is_initial(&self) -> bool
Check whether the node is in its initial state.
Sourcepub fn insert_before(
self: Pin<&mut Self>,
cursor: &mut CursorMut<'_, T>,
protected: T::Protected,
unprotected: T::Unprotected,
) -> Pin<&mut InitializedNode<'_, T>>
pub fn insert_before( self: Pin<&mut Self>, cursor: &mut CursorMut<'_, T>, protected: T::Protected, unprotected: T::Unprotected, ) -> Pin<&mut InitializedNode<'_, T>>
Insert this node into the linked list before the given cursor.
§Panics
Panics if the node is not in its initial state.
Sourcepub fn insert_after(
self: Pin<&mut Self>,
cursor: &mut CursorMut<'_, T>,
protected: T::Protected,
unprotected: T::Unprotected,
) -> Pin<&mut InitializedNode<'_, T>>
pub fn insert_after( self: Pin<&mut Self>, cursor: &mut CursorMut<'_, T>, protected: T::Protected, unprotected: T::Unprotected, ) -> Pin<&mut InitializedNode<'_, T>>
Insert this node into the linked list after the given cursor.
§Panics
Panics if the node is not in its initial state.
Sourcepub fn initialized(&self) -> Option<&InitializedNode<'_, T>>
pub fn initialized(&self) -> Option<&InitializedNode<'_, T>>
Borrow the node, if it is initialized (linked or removed).
Returns None if the node is in the initial state.
Sourcepub fn initialized_mut(
self: Pin<&mut Self>,
) -> Option<Pin<&mut InitializedNode<'_, T>>>
pub fn initialized_mut( self: Pin<&mut Self>, ) -> Option<Pin<&mut InitializedNode<'_, T>>>
Borrow uniquely the node, if it is initialized (linked or removed).
Returns None if the node is in the initial state.