PushBack

Trait PushBack 

Source
pub trait PushBack<E>: HList {
    type Output;

    // Required method
    fn push_back(self, element: E) -> Self::Output;
}
Expand description

Adds an element at the end of the list

Inverse of PushFront

Required Associated Types§

Source

type Output

The type of the resulting list.

Required Methods§

Source

fn push_back(self, element: E) -> Self::Output

Pushes an element at the end of the list.

§Examples
§With HCons
use tuplify::*;
let list = hcons!['1', "2"].push_back(0);

assert_eq!(list, hcons!['1', "2", 0]);
§With tuples
use tuplify::*;
let list = ('1', "2").push_back(0);

assert_eq!(list, ('1', "2", 0));
use tuplify::*;
let list = ('1', "2").push_back((0, 1));

assert_eq!(list, ('1', "2", (0, 1)));
use tuplify::*;
let list = ().push_back(1);

assert_eq!(list, (1,));

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<E> PushBack<E> for ()

Source§

type Output = (E,)

Source§

fn push_back(self, element: E) -> Self::Output

Implementors§

Source§

impl<E> PushBack<E> for HEmpty

Source§

impl<L, E> PushBack<E> for L
where L: Uncons, L::Tail: PushBack<E>, <L::Tail as PushBack<E>>::Output: PushFront<L::Head>,

Source§

type Output = <<<L as Uncons>::Tail as PushBack<E>>::Output as PushFront<<L as Uncons>::Head>>::Output