pub trait Append {
type Append<T>;
}
Expand description
Trait to append some value to the end of a tuple.
§Examples
// Append a value to the unit value.
assert_type_eq_all!(<() as Append>::Append<usize>, (usize,));
// Append a value to a single value tuple.
assert_type_eq_all!(<(usize,) as Append>::Append<char>, (usize, char));
// Append a value to a multi-value tuple.
assert_type_eq_all!(<(usize, char) as Append>::Append<bool>, (usize, char, bool));
The trait can also be used to modify the return value based on some generic.
fn append_usize<T>(value: T) -> T::Append<usize>
where
T: Append
{
// ...
}
let result: (char, bool, usize) = append_usize(('a', true));
Required Associated Types§
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.