Trait TupleInsert

Source
pub trait TupleInsert<T> {
    // Provided method
    fn insert<const POS: usize>(self, val: T) -> Self::Output
       where Self: TupleInsertExact<POS, T> + Sized { ... }
}
Expand description

Insert a value into a tuple.

Unlike TupleInsertExact, this trait moves the const POS to a method, so it can be used with the help of type derivation without explicitly declaring the underlying trait.

§Example

use rs_std_ext::tuple::TupleInsert;

let x = (10u8, 'a');
let y = x.insert::<1>(-5i32);

assert_eq!(y, (10u8, -5i32, 'a'));

Provided Methods§

Source

fn insert<const POS: usize>(self, val: T) -> Self::Output
where Self: TupleInsertExact<POS, T> + Sized,

Implementations on Foreign Types§

§

impl<A, B, C, D, E, F, G, H, I, J, Z> TupleInsert<Z> for (A, B, C, D, E, F, G, H, I, J)

§

impl<A, B, C, D, E, F, G, H, I, Z> TupleInsert<Z> for (A, B, C, D, E, F, G, H, I)

§

impl<A, B, C, D, E, F, G, H, Z> TupleInsert<Z> for (A, B, C, D, E, F, G, H)

§

impl<A, B, C, D, E, F, G, Z> TupleInsert<Z> for (A, B, C, D, E, F, G)

§

impl<A, B, C, D, E, F, Z> TupleInsert<Z> for (A, B, C, D, E, F)

§

impl<A, B, C, D, E, Z> TupleInsert<Z> for (A, B, C, D, E)

§

impl<A, B, C, D, Z> TupleInsert<Z> for (A, B, C, D)

§

impl<A, B, C, Z> TupleInsert<Z> for (A, B, C)

§

impl<A, B, Z> TupleInsert<Z> for (A, B)

§

impl<A, Z> TupleInsert<Z> for (A,)

Implementors§