pub trait Tuple: Sealed {
type Append<T>: Tuple;
type Prepend<T>: Tuple;
const ARITY: usize;
// Required methods
fn append<T>(self, value: T) -> Self::Append<T>;
fn prepend<T>(self, value: T) -> Self::Prepend<T>;
}
Expand description
A trait representing tuples. It is only implemented for tuples of arity 0 to 50.
This trait is sealed and as such not meant to be implemented.
The arity or length of this tuple type.
Consumes this tuple and appends a value to it, returning a new tuple.
let tuple = (1, 2);
let tuple = tuple.append(3);
assert_eq!(tuple, (1, 2, 3));
Calling this function on a tuple of arity 50 or greater will cause a panic.
Consumes this tuple and prepends a value to it, returning a new tuple.
let tuple = (2, 3);
let tuple = tuple.prepend(1);
assert_eq!(tuple, (1, 2, 3));
Calling this function on a tuple of arity 50 or greater will cause a panic.