Trait tuple_split::TupleSplit
source · pub trait TupleSplit<const MIDDLE: usize>: Tuple {
type Left;
type Right;
// Required method
fn split_tuple(self) -> (Self::Left, Self::Right);
}
Expand description
Tuples which may be split at index MIDDLE have the trait TupleSplit
use tupleops::concat_tuples;
use tuple_split::*;
let t: (u8, f32, &str) = (1, 1.0, "test");
let (l, r): ((u8, f32), (&str,)) = TupleSplit::<2>::split_tuple(t);
assert_eq!(t, concat_tuples(l, r));