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§
Required Methods§
Sourcefn push_back(self, element: E) -> Self::Output
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.