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 aProtected
and anUnprotected
, of which the former can only be accessed when access to thePinList
can be proven. Dropping a node in this state will abort. - Removed:
The node has been removed from a
PinList
. It holds aRemoved
and anUnprotected
. Similar to the “linked” state, proof of access to thePinList
is required for most operations. Dropping a node in this state will abort.
Implementations
sourceimpl<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
.
sourceimpl<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.
Trait Implementations
impl<T: ?Sized + Types> Send for Node<T> where
T::Id: Send,
T::Protected: Send,
T::Removed: Send,
T::Unprotected: Send,
T::Unprotected: Sync,
impl<T: ?Sized + Types> Sync for Node<T> where
T::Id: Sync,
T::Unprotected: Sync,
impl<'__pin, T: ?Sized> Unpin for Node<T> where
__Origin<'__pin, T>: Unpin,
T: Types,
Auto Trait Implementations
impl<T> !RefUnwindSafe for Node<T>
impl<T> !UnwindSafe for Node<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more