Trait tuple_list::TupleCons[][src]

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

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

Associated Types

Tuple with Head prepended to Self

Required methods

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

Implementations on Foreign Types

Implementors