pub enum List<T> {
Cons(T, Box<List<T>>),
Nil,
}Variants§
Implementations§
Source§impl<T: Clone> List<T>
impl<T: Clone> List<T>
pub fn prepend(self, x: T) -> Self
pub fn append(self, item: T) -> Self
pub fn concat(self, other: Self) -> Self
pub fn get(&self, index: u32) -> Option<&T>
pub fn head(&self) -> Option<&T>
pub fn tail(&self) -> Self
pub fn foldl<R>(self, func: impl Fn(R, T) -> R + Copy, init: R) -> R
pub fn foldr<R>(self, func: impl Fn(T, R) -> R + Copy, init: R) -> R
pub fn reverse(self) -> List<T>
pub fn map<R>(self, func: impl Fn(T) -> R + Copy) -> List<R>
pub fn filter(self, func: impl Fn(&T) -> bool + Copy) -> Self
pub fn qsort_by(self, cmpfn: impl Fn(&T, &T) -> Ordering + Copy) -> Self
Trait Implementations§
impl<T: Eq> Eq for List<T>
impl<T> StructuralPartialEq for List<T>
Auto Trait Implementations§
impl<T> Freeze for List<T>where
T: Freeze,
impl<T> RefUnwindSafe for List<T>where
T: RefUnwindSafe,
impl<T> Send for List<T>where
T: Send,
impl<T> Sync for List<T>where
T: Sync,
impl<T> Unpin for List<T>where
T: Unpin,
impl<T> UnsafeUnpin for List<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for List<T>where
T: UnwindSafe,
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