[][src]Trait tuple_list::TupleCons

pub trait TupleCons<Head>: Tuple {
    type ConsResult: Tuple;
    fn cons(head: Head, tail: Self) -> Self::ConsResult;
}

Trait providing tuple construction function, allows to prepend a value to a tuple.

Associated Types

type ConsResult: Tuple

Tuple with Head prepended to Self

Loading content...

Required methods

fn cons(head: Head, tail: Self) -> Self::ConsResult

Constructs a tuple from head value and tail tuple by prepending head to tail.

Reverse of NonEmptyTuple::uncons.

Examples

use tuple_list::TupleCons;
 
let a = TupleCons::cons("foo", ());
assert_eq!(
    a,
    ("foo",),
);
 
let b = TupleCons::cons(false, a);
assert_eq!(
    b,
    (false, "foo"),
);
 
let c = TupleCons::cons(4, b);
assert_eq!(
    c,
    (4, false, "foo"),
);
Run
Loading content...

Implementations on Foreign Types

impl<T1> TupleCons<T1> for ()[src]

type ConsResult = (T1,)

impl<T1, T2> TupleCons<T1> for (T2,)[src]

type ConsResult = (T1, T2)

impl<T1, T2, T3> TupleCons<T1> for (T2, T3)[src]

type ConsResult = (T1, T2, T3)

impl<T1, T2, T3, T4> TupleCons<T1> for (T2, T3, T4)[src]

type ConsResult = (T1, T2, T3, T4)

impl<T1, T2, T3, T4, T5> TupleCons<T1> for (T2, T3, T4, T5)[src]

type ConsResult = (T1, T2, T3, T4, T5)

impl<T1, T2, T3, T4, T5, T6> TupleCons<T1> for (T2, T3, T4, T5, T6)[src]

type ConsResult = (T1, T2, T3, T4, T5, T6)

impl<T1, T2, T3, T4, T5, T6, T7> TupleCons<T1> for (T2, T3, T4, T5, T6, T7)[src]

type ConsResult = (T1, T2, T3, T4, T5, T6, T7)

impl<T1, T2, T3, T4, T5, T6, T7, T8> TupleCons<T1> for (T2, T3, T4, T5, T6, T7, T8)[src]

type ConsResult = (T1, T2, T3, T4, T5, T6, T7, T8)

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9> TupleCons<T1> for (T2, T3, T4, T5, T6, T7, T8, T9)[src]

type ConsResult = (T1, T2, T3, T4, T5, T6, T7, T8, T9)

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> TupleCons<T1> for (T2, T3, T4, T5, T6, T7, T8, T9, T10)[src]

type ConsResult = (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> TupleCons<T1> for (T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)[src]

type ConsResult = (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> TupleCons<T1> for (T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)[src]

type ConsResult = (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)

Loading content...

Implementors

Loading content...