pub struct LinkList<T> {
pub nodes: VecDeque<T>,
pub flags: u32,
}Expand description
A doubly-ended list, port of struct linklist (Src/zsh.h:563).
flags carries LF_ARRAY and friends from Src/subst.c:33.
Fields§
§nodes: VecDeque<T>§flags: u32Implementations§
Source§impl<T> LinkList<T>
impl<T> LinkList<T>
Sourcepub fn new() -> Self
pub fn new() -> Self
Port of znewlinklist() from Src/linklist.c:116 — heap-arena
fresh empty list. Rust uses LinkList::new().
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Port of the C macro empty(list) (Src/zsh.h:583) —
firstnode(list) == NULL.
Sourcepub fn push_front(&mut self, data: T)
pub fn push_front(&mut self, data: T)
Push at the head. Port of the C macro pushnode() (Src/zsh.h).
Sourcepub fn push_back(&mut self, data: T)
pub fn push_back(&mut self, data: T)
Push at the tail. Port of addlinknode() (Src/zsh.h) /
zaddlinknode() (Src/linklist.c:151).
Sourcepub fn pop_front(&mut self) -> Option<T>
pub fn pop_front(&mut self) -> Option<T>
Pop the head. Port of getlinknode(LinkList list) (Src/linklist.c:210).
Sourcepub fn pop_back(&mut self) -> Option<T>
pub fn pop_back(&mut self) -> Option<T>
Pop the tail. Port of remnode(list, lastnode(list)) idiom.
Sourcepub fn front(&self) -> Option<&T>
pub fn front(&self) -> Option<&T>
Front-element ref, equivalent to firstnode(list)->dat
(Src/zsh.h:576,586).
Sourcepub fn back(&self) -> Option<&T>
pub fn back(&self) -> Option<&T>
Back-element ref, equivalent to lastnode(list)->dat
(Src/zsh.h:577,586).
Sourcepub fn append(&mut self, other: &mut LinkList<T>)
pub fn append(&mut self, other: &mut LinkList<T>)
Append other onto the tail; drains other. Port of
joinlists() (Src/linklist.c:360).
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Drop every node. Port of freelinklist(list, NULL)
(Src/linklist.c:287).
Sourcepub fn firstnode(&self) -> Option<usize>
pub fn firstnode(&self) -> Option<usize>
Port of firstnode(X) macro (Src/zsh.h:576) — head node
handle. Rust uses usize indices since the VecDeque backing
gives O(1) random access matching C’s pointer walk.
Sourcepub fn insertlinknode(&mut self, after_idx: usize, data: T) -> usize
pub fn insertlinknode(&mut self, after_idx: usize, data: T) -> usize
Port of insertlinknode(list, after, dat) macro
(Src/zsh.h:580) and the function form (Src/linklist.c:133)
— insert after the supplied node index, return the index of the
inserted node.
WARNING: param names don’t match C — Rust=(after_idx, data) vs C=(list, node, dat)
Sourcepub fn delete_node(&mut self, idx: usize) -> Option<T>
pub fn delete_node(&mut self, idx: usize) -> Option<T>
Remove + free a node. Port of remnode(LinkList list, LinkNode nd) (Src/linklist.c:251).
Trait Implementations§
Source§impl<T> FromIterator<T> for LinkList<T>
impl<T> FromIterator<T> for LinkList<T>
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Source§impl<T> IntoIterator for LinkList<T>
impl<T> IntoIterator for LinkList<T>
Auto Trait Implementations§
impl<T> Freeze for LinkList<T>
impl<T> RefUnwindSafe for LinkList<T>where
T: RefUnwindSafe,
impl<T> Send for LinkList<T>where
T: Send,
impl<T> Sync for LinkList<T>where
T: Sync,
impl<T> Unpin for LinkList<T>where
T: Unpin,
impl<T> UnsafeUnpin for LinkList<T>
impl<T> UnwindSafe for LinkList<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more