Crate tuplestructops
source · [−]Expand description
Structural operations for tuples
This crate implements splitting and joining tuples.
The traits are implemented for tuples from zero len (ie, ()
unit) to 16.
(More with with the tuple_24
and tuple_32
features enabled.)
They are implemented for both tuples by value and reference, which either consume or borrow their inputs respectively.
An example of TupleJoin
by value:
use tuplestructops::TupleJoin;
let out = (1,'a',"b").join((1., 2.));
println!("out {out:?}");
TupleSplit
does the converse. It relies on pattern matching to determine
the split.
use tuplestructops::TupleSplit;
let out: (_, (_,_,_)) = (1,2,3,4,5).split();
println!("out {out:?}");
Traits
Implement join
for tuples.
Split a tuple into left and right portions.
Type Definitions
Resulting type of joining tuples L
and R
. This is useful for referencing
it in other type contexts. For example: