Trait Index

Source
pub trait Index<const N: usize>: Tuple {
    type Nth;
    type NthMapped<U>;

    // Required methods
    fn nth(this: Self) -> Self::Nth;
    fn nth_ref(this: &Self) -> &Self::Nth;
    fn map_nth<U>(
        this: Self,
        f: impl FnOnce(Self::Nth) -> U,
    ) -> Self::NthMapped<U>;
}
Expand description

The trait for a tuple that has the N-th element, the backbone of the Tuple::nth function.

The associated functions are not to be used directly, instead use the equivalent functions or methods of the Tuple trait.

Required Associated Types§

Source

type Nth

The N-th element of the tuple.

Source

type NthMapped<U>

The tuple with its N-th element mapped to U.

Required Methods§

Source

fn nth(this: Self) -> Self::Nth

Returns the N-th element of the tuple.

Source

fn nth_ref(this: &Self) -> &Self::Nth

Returns a reference to the N-th element of the tuple.

Source

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Returns the tuple with the N-th element transformed by f

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.

Implementations on Foreign Types§

Source§

impl<T0> Index<0> for (T0,)

Source§

type Nth = T0

Source§

type NthMapped<U> = (U,)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1> Index<0> for (T0, T1)

Source§

type Nth = T0

Source§

type NthMapped<U> = (U, T1)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1> Index<1> for (T0, T1)

Source§

type Nth = T1

Source§

type NthMapped<U> = (T0, U)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2> Index<0> for (T0, T1, T2)

Source§

type Nth = T0

Source§

type NthMapped<U> = (U, T1, T2)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2> Index<1> for (T0, T1, T2)

Source§

type Nth = T1

Source§

type NthMapped<U> = (T0, U, T2)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2> Index<2> for (T0, T1, T2)

Source§

type Nth = T2

Source§

type NthMapped<U> = (T0, T1, U)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3> Index<0> for (T0, T1, T2, T3)

Source§

type Nth = T0

Source§

type NthMapped<U> = (U, T1, T2, T3)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3> Index<1> for (T0, T1, T2, T3)

Source§

type Nth = T1

Source§

type NthMapped<U> = (T0, U, T2, T3)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3> Index<2> for (T0, T1, T2, T3)

Source§

type Nth = T2

Source§

type NthMapped<U> = (T0, T1, U, T3)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3> Index<3> for (T0, T1, T2, T3)

Source§

type Nth = T3

Source§

type NthMapped<U> = (T0, T1, T2, U)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4> Index<0> for (T0, T1, T2, T3, T4)

Source§

type Nth = T0

Source§

type NthMapped<U> = (U, T1, T2, T3, T4)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4> Index<1> for (T0, T1, T2, T3, T4)

Source§

type Nth = T1

Source§

type NthMapped<U> = (T0, U, T2, T3, T4)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4> Index<2> for (T0, T1, T2, T3, T4)

Source§

type Nth = T2

Source§

type NthMapped<U> = (T0, T1, U, T3, T4)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4> Index<3> for (T0, T1, T2, T3, T4)

Source§

type Nth = T3

Source§

type NthMapped<U> = (T0, T1, T2, U, T4)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4> Index<4> for (T0, T1, T2, T3, T4)

Source§

type Nth = T4

Source§

type NthMapped<U> = (T0, T1, T2, T3, U)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5> Index<0> for (T0, T1, T2, T3, T4, T5)

Source§

type Nth = T0

Source§

type NthMapped<U> = (U, T1, T2, T3, T4, T5)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5> Index<1> for (T0, T1, T2, T3, T4, T5)

Source§

type Nth = T1

Source§

type NthMapped<U> = (T0, U, T2, T3, T4, T5)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5> Index<2> for (T0, T1, T2, T3, T4, T5)

Source§

type Nth = T2

Source§

type NthMapped<U> = (T0, T1, U, T3, T4, T5)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5> Index<3> for (T0, T1, T2, T3, T4, T5)

Source§

type Nth = T3

Source§

type NthMapped<U> = (T0, T1, T2, U, T4, T5)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5> Index<4> for (T0, T1, T2, T3, T4, T5)

Source§

type Nth = T4

Source§

type NthMapped<U> = (T0, T1, T2, T3, U, T5)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5> Index<5> for (T0, T1, T2, T3, T4, T5)

Source§

type Nth = T5

Source§

type NthMapped<U> = (T0, T1, T2, T3, T4, U)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5, T6> Index<0> for (T0, T1, T2, T3, T4, T5, T6)

Source§

type Nth = T0

Source§

type NthMapped<U> = (U, T1, T2, T3, T4, T5, T6)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5, T6> Index<1> for (T0, T1, T2, T3, T4, T5, T6)

Source§

type Nth = T1

Source§

type NthMapped<U> = (T0, U, T2, T3, T4, T5, T6)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5, T6> Index<2> for (T0, T1, T2, T3, T4, T5, T6)

Source§

type Nth = T2

Source§

type NthMapped<U> = (T0, T1, U, T3, T4, T5, T6)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5, T6> Index<3> for (T0, T1, T2, T3, T4, T5, T6)

Source§

type Nth = T3

Source§

type NthMapped<U> = (T0, T1, T2, U, T4, T5, T6)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5, T6> Index<4> for (T0, T1, T2, T3, T4, T5, T6)

Source§

type Nth = T4

Source§

type NthMapped<U> = (T0, T1, T2, T3, U, T5, T6)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5, T6> Index<5> for (T0, T1, T2, T3, T4, T5, T6)

Source§

type Nth = T5

Source§

type NthMapped<U> = (T0, T1, T2, T3, T4, U, T6)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5, T6> Index<6> for (T0, T1, T2, T3, T4, T5, T6)

Source§

type Nth = T6

Source§

type NthMapped<U> = (T0, T1, T2, T3, T4, T5, U)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> Index<0> for (T0, T1, T2, T3, T4, T5, T6, T7)

Source§

type Nth = T0

Source§

type NthMapped<U> = (U, T1, T2, T3, T4, T5, T6, T7)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> Index<1> for (T0, T1, T2, T3, T4, T5, T6, T7)

Source§

type Nth = T1

Source§

type NthMapped<U> = (T0, U, T2, T3, T4, T5, T6, T7)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> Index<2> for (T0, T1, T2, T3, T4, T5, T6, T7)

Source§

type Nth = T2

Source§

type NthMapped<U> = (T0, T1, U, T3, T4, T5, T6, T7)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> Index<3> for (T0, T1, T2, T3, T4, T5, T6, T7)

Source§

type Nth = T3

Source§

type NthMapped<U> = (T0, T1, T2, U, T4, T5, T6, T7)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> Index<4> for (T0, T1, T2, T3, T4, T5, T6, T7)

Source§

type Nth = T4

Source§

type NthMapped<U> = (T0, T1, T2, T3, U, T5, T6, T7)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> Index<5> for (T0, T1, T2, T3, T4, T5, T6, T7)

Source§

type Nth = T5

Source§

type NthMapped<U> = (T0, T1, T2, T3, T4, U, T6, T7)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> Index<6> for (T0, T1, T2, T3, T4, T5, T6, T7)

Source§

type Nth = T6

Source§

type NthMapped<U> = (T0, T1, T2, T3, T4, T5, U, T7)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> Index<7> for (T0, T1, T2, T3, T4, T5, T6, T7)

Source§

type Nth = T7

Source§

type NthMapped<U> = (T0, T1, T2, T3, T4, T5, T6, U)

Source§

fn nth(this: Self) -> Self::Nth

Source§

fn nth_ref(this: &Self) -> &Self::Nth

Source§

fn map_nth<U>(this: Self, f: impl FnOnce(Self::Nth) -> U) -> Self::NthMapped<U>

Implementors§