pub trait TupleInsertExact<const POS: usize, T> {
type Output;
// Required method
fn insert(self, val: T) -> Self::Output;
}
Expand description
Insert a value into a tuple.
This is internally used behind the TupleInsert
trait for convenience.
However, if something goes wrong with the trait solver, this trait can also be used explicitly.
§Example
use rs_std_ext::tuple::TupleInsertExact;
let x = (10u8, 'a');
let y = <(u8, char) as TupleInsertExact<1, _>>::insert(x, -5i32);
assert_eq!(y, (10u8, -5i32, 'a'));