List

Struct List 

Source
pub struct List<L>(pub L);
Expand description

Heterogenous list Supports pushing, splitting to head and tail Mapping and folding

Tuple Fields§

§0: L

Implementations§

Source§

impl List<()>

Source

pub fn new() -> List<()>

Source§

impl<L> List<L>

Source

pub fn push<V>(self, value: V) -> List<(V, List<L>)>

Source§

impl<H, T> List<(H, List<T>)>

Source

pub fn head(&self) -> &H

Source

pub fn tail(&self) -> &List<T>

Trait Implementations§

Source§

impl<'a> ByRef<'a> for List<()>

Source§

type Refs = List<()>

Source§

fn by_ref(&'a self) -> Self::Refs

Source§

impl<'a, H: 'a, T, R: 'a> ByRef<'a> for List<(H, T)>
where T: ByRef<'a, Refs = R> + 'a,

Source§

type Refs = List<(&'a H, R)>

Source§

fn by_ref(&'a self) -> Self::Refs

Source§

impl<L: Clone> Clone for List<L>

Source§

fn clone(&self) -> List<L>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<L: Debug> Debug for List<L>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<I, F> Foldable<I, F> for List<()>

Source§

fn fold(self, init: I, _: F) -> I

fold sequence using Function starting with Init value
Source§

impl<I, F, H, T> Foldable<I, F> for List<(H, T)>
where T: Foldable<I, F>, F: FnMut<(H, I), Output = I>,

Source§

fn fold(self, init: I, f: F) -> I

fold sequence using Function starting with Init value
Source§

impl<'a, F> Functor<F> for &'a List<()>

Source§

type Output = List<()>

Result of mapping
Source§

fn fmap(self, _: F) -> List<()>

Map sequence using Function
Source§

impl<'a, F, H, T, O, U> Functor<F> for &'a List<(H, T)>
where &'a T: Functor<F, Output = U>, F: FnMut<(&'a H,), Output = O>,

Source§

type Output = List<(O, U)>

Result of mapping
Source§

fn fmap(self, f: F) -> Self::Output

Map sequence using Function
Source§

impl<'a, F, H, T, O, U> Functor<F> for &'a mut List<(H, T)>
where &'a mut T: Functor<F, Output = U>, F: FnMut<(&'a mut H,), Output = O>,

Source§

type Output = List<(O, U)>

Result of mapping
Source§

fn fmap(self, f: F) -> Self::Output

Map sequence using Function
Source§

impl<F> Functor<F> for List<()>

Source§

type Output = List<()>

Result of mapping
Source§

fn fmap(self, _: F) -> List<()>

Map sequence using Function
Source§

impl<F, H, T, O, U> Functor<F> for List<(H, T)>
where T: Functor<F, Output = U>, F: FnMut<(H,), Output = O>,

Source§

type Output = List<(O, U)>

Result of mapping
Source§

fn fmap(self, f: F) -> Self::Output

Map sequence using Function
Source§

impl<L> IntoList for List<L>

Source§

type List = List<L>

Source§

fn into_list(self) -> Self

Source§

impl Length for List<()>

Source§

impl<H, T> Length for List<(H, T)>
where T: Length,

Source§

impl<L: Ord> Ord for List<L>

Source§

fn cmp(&self, other: &List<L>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<L: PartialEq> PartialEq for List<L>

Source§

fn eq(&self, other: &List<L>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<L: PartialOrd> PartialOrd for List<L>

Source§

fn partial_cmp(&self, other: &List<L>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<E> Try<E> for List<()>

Source§

type Ok = List<()>

Sequence of Ok Results
Source§

fn try(self) -> Result<List<()>, E>

Source§

impl<E, H, T, Z> Try<E> for List<(Result<H, E>, T)>
where T: Try<E, Ok = Z>,

Source§

type Ok = List<(H, Z)>

Sequence of Ok Results
Source§

fn try(self) -> Result<List<(H, Z)>, E>

Source§

impl Zip<List<()>> for List<()>

Source§

type Zipped = List<()>

Source§

fn zip(self, _: List<()>) -> List<()>

Source§

impl<LH, LT, RH, RT, ZT> Zip<List<(RH, RT)>> for List<(LH, LT)>
where LT: Zip<RT, Zipped = ZT>,

Source§

type Zipped = List<((LH, RH), ZT)>

Source§

fn zip(self, right: List<(RH, RT)>) -> Self::Zipped

Source§

impl<L: Copy> Copy for List<L>

Source§

impl<L: Eq> Eq for List<L>

Source§

impl<L> StructuralPartialEq for List<L>

Auto Trait Implementations§

§

impl<L> Freeze for List<L>
where L: Freeze,

§

impl<L> RefUnwindSafe for List<L>
where L: RefUnwindSafe,

§

impl<L> Send for List<L>
where L: Send,

§

impl<L> Sync for List<L>
where L: Sync,

§

impl<L> Unpin for List<L>
where L: Unpin,

§

impl<L> UnwindSafe for List<L>
where L: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<L> IntoQueue for L
where L: IntoQueueImpl<Queue<()>>,

Source§

type Queue = <L as IntoQueueImpl<Queue<()>>>::Queue

Source§

fn into_queue(self) -> <L as IntoQueue>::Queue

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.