pub enum List<'parent, T> {
Cons(&'parent List<'parent, T>, T),
Nil,
}Expand description
A stack or arena-allocable append-only linked list.
Variants§
Cons(&'parent List<'parent, T>, T)
A list with one more element than its parent
Nil
The base case: an empty list
Implementations§
Source§impl<'parent, T> List<'parent, T>
impl<'parent, T> List<'parent, T>
Sourcepub fn enter<'a>(&'a self, value: T) -> List<'a, T>where
T: 'a,
pub fn enter<'a>(&'a self, value: T) -> List<'a, T>where
T: 'a,
Creates a List with one more element than self
Sourcepub fn parent(&self) -> Option<&List<'parent, T>>
pub fn parent(&self) -> Option<&List<'parent, T>>
Gets the parent element of this List (the cdr)
pub fn get_reverse(&self) -> Vec<&T>
Trait Implementations§
impl<'parent, T: Copy> Copy for List<'parent, T>
Auto Trait Implementations§
impl<'parent, T> Freeze for List<'parent, T>where
T: Freeze,
impl<'parent, T> RefUnwindSafe for List<'parent, T>where
T: RefUnwindSafe,
impl<'parent, T> Send for List<'parent, T>
impl<'parent, T> Sync for List<'parent, T>where
T: Sync,
impl<'parent, T> Unpin for List<'parent, T>where
T: Unpin,
impl<'parent, T> UnsafeUnpin for List<'parent, T>where
T: UnsafeUnpin,
impl<'parent, T> UnwindSafe for List<'parent, T>where
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more