pub trait NonUnaryTuple: NonEmptyTuple<TruncateHead: NonEmptyTuple<Tail = Self::Tail>, TruncateTail: NonEmptyTuple<Head = Self::Head>> {
type TruncateHeadTail: GrowableTuple<Prepend<Self::Head> = Self::TruncateTail, Append<Self::Tail> = Self::TruncateHead>;
// Required methods
fn head_tail(&self) -> (&Self::Head, &Self::Tail);
fn head_tail_mut(&mut self) -> (&mut Self::Head, &mut Self::Tail);
fn truncate_head_tail(
self,
) -> (Self::Head, Self::TruncateHeadTail, Self::Tail);
}Expand description
Tuples that not unary nor empty. Implemented for sized tuples of arity 2 to 32.
Required Associated Types§
Sourcetype TruncateHeadTail: GrowableTuple<Prepend<Self::Head> = Self::TruncateTail, Append<Self::Tail> = Self::TruncateHead>
type TruncateHeadTail: GrowableTuple<Prepend<Self::Head> = Self::TruncateTail, Append<Self::Tail> = Self::TruncateHead>
This tuple with its head and tail truncated.
Required Methods§
Sourcefn head_tail(&self) -> (&Self::Head, &Self::Tail)
fn head_tail(&self) -> (&Self::Head, &Self::Tail)
Returns a reference to the head and tail of this tuple.
§Examples
let tuple = (1, 2, 3, 4);
let (head, tail) = tuple.head_tail();
assert_eq!((&1, &4), (head, tail));Sourcefn head_tail_mut(&mut self) -> (&mut Self::Head, &mut Self::Tail)
fn head_tail_mut(&mut self) -> (&mut Self::Head, &mut Self::Tail)
Returns a mutable reference to the head and tail of this tuple.
§Examples
let mut tuple = (1, 2, 3, 4);
let (head, tail) = tuple.head_tail_mut();
assert_eq!((&mut 1, &mut 4), (head, tail));Sourcefn truncate_head_tail(self) -> (Self::Head, Self::TruncateHeadTail, Self::Tail)
fn truncate_head_tail(self) -> (Self::Head, Self::TruncateHeadTail, Self::Tail)
Consumes this tuple and truncates its head and tail from the remaining elements.
§Examples
let tuple = (1, 2, 3, 4);
let (head, tuple, tail) = tuple.truncate_head_tail();
assert_eq!((1, (2, 3), 4), (head, tuple, tail));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.