type LinkedList<T> = LinkedList<ListEntry<T>, <ListEntry<T> as Link>::Target>;
Aliased Type§
struct LinkedList<T> {
head: Option<NonNull<ListEntry<T>>>,
tail: Option<NonNull<ListEntry<T>>>,
_marker: PhantomData<*const ListEntry<T>>,
}
Fields§
§head: Option<NonNull<ListEntry<T>>>
Linked list head
tail: Option<NonNull<ListEntry<T>>>
Linked list tail
_marker: PhantomData<*const ListEntry<T>>
Node type marker.
Implementations
Source§impl<L: Link> LinkedList<L, L::Target>
impl<L: Link> LinkedList<L, L::Target>
Sourcepub(crate) fn push_front(&mut self, val: L::Handle)
pub(crate) fn push_front(&mut self, val: L::Handle)
Adds an element first in the list.
Sourcepub(crate) fn pop_front(&mut self) -> Option<L::Handle>
pub(crate) fn pop_front(&mut self) -> Option<L::Handle>
Removes the first element from a list and returns it, or None if it is empty.
Sourcepub(crate) fn pop_back(&mut self) -> Option<L::Handle>
pub(crate) fn pop_back(&mut self) -> Option<L::Handle>
Removes the last element from a list and returns it, or None if it is empty.
Sourcepub(crate) fn is_empty(&self) -> bool
pub(crate) fn is_empty(&self) -> bool
Returns whether the linked list does not contain any node
Sourcepub(crate) unsafe fn remove(
&mut self,
node: NonNull<L::Target>,
) -> Option<L::Handle>
pub(crate) unsafe fn remove( &mut self, node: NonNull<L::Target>, ) -> Option<L::Handle>
Removes the specified node from the list
§Safety
The caller must ensure that exactly one of the following is true:
node
is currently contained byself
,node
is not contained by any list,node
is currently contained by some otherGuardedLinkedList
and the caller has an exclusive access to that list. This condition is used by the linked list insync::Notify
.
Source§impl<L: Link> LinkedList<L, L::Target>
impl<L: Link> LinkedList<L, L::Target>
Sourcepub(crate) fn into_guarded(
self,
guard_handle: L::Handle,
) -> GuardedLinkedList<L, L::Target>
pub(crate) fn into_guarded( self, guard_handle: L::Handle, ) -> GuardedLinkedList<L, L::Target>
Turns a linked list into the guarded version by linking the guard node with the head and tail nodes. Like with other nodes, you should guarantee that the guard node is pinned in memory.
Source§impl<L, T> LinkedList<L, T>
impl<L, T> LinkedList<L, T>
Sourcepub(crate) const fn new() -> LinkedList<L, T>
pub(crate) const fn new() -> LinkedList<L, T>
Creates an empty linked list.