Skip to main content

TupleRowMut

Trait TupleRowMut 

Source
pub trait TupleRowMut<Idx>: TupleRow<Idx, RowType: TupleMut> {
    // Required method
    fn tuple_row_mut(&mut self) -> <Self::RowType as TupleMut>::Mut<'_>;
}
Expand description

A trait for mutable indexing rows in tuples of tuples.

This trait allows mutable access to elements at a specific index across all tuples in a tuple of tuples. For a tuple of tuples like ((A, B), (C, D)), TupleRowMut<U0> would return (&mut A, &mut C) and TupleRowMut<U1> would return (&mut B, &mut D).

Each inner tuple must implement TupleIndexMut<Idx>, and the returned row tuple implements TupleMut.

§Examples

use tuplities_row::TupleRowMut;
use typenum::U0;

let mut matrix = ((1, 2), (3, 4), (5, 6));
let first_row = TupleRowMut::<U0>::tuple_row_mut(&mut matrix);
*first_row.0 = 10;
*first_row.1 = 30;
*first_row.2 = 50;
assert_eq!(matrix, ((10, 2), (30, 4), (50, 6)));

Part of the tuplities crate.

Required Methods§

Source

fn tuple_row_mut(&mut self) -> <Self::RowType as TupleMut>::Mut<'_>

Returns a tuple of mutable references to the elements at index Idx in each inner tuple.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<Idx, T1: TupleIndexMut<Idx>, T2: TupleIndexMut<Idx>, T3: TupleIndexMut<Idx>, T4: TupleIndexMut<Idx>, T5: TupleIndexMut<Idx>, T6: TupleIndexMut<Idx>, T7: TupleIndexMut<Idx>, T8: TupleIndexMut<Idx>> TupleRowMut<Idx> for (T1, T2, T3, T4, T5, T6, T7, T8)

Source§

fn tuple_row_mut(&mut self) -> <Self::RowType as TupleMut>::Mut<'_>

Source§

impl<Idx, T1: TupleIndexMut<Idx>, T2: TupleIndexMut<Idx>, T3: TupleIndexMut<Idx>, T4: TupleIndexMut<Idx>, T5: TupleIndexMut<Idx>, T6: TupleIndexMut<Idx>, T7: TupleIndexMut<Idx>> TupleRowMut<Idx> for (T1, T2, T3, T4, T5, T6, T7)

Source§

fn tuple_row_mut(&mut self) -> <Self::RowType as TupleMut>::Mut<'_>

Source§

impl<Idx, T1: TupleIndexMut<Idx>, T2: TupleIndexMut<Idx>, T3: TupleIndexMut<Idx>, T4: TupleIndexMut<Idx>, T5: TupleIndexMut<Idx>, T6: TupleIndexMut<Idx>> TupleRowMut<Idx> for (T1, T2, T3, T4, T5, T6)

Source§

fn tuple_row_mut(&mut self) -> <Self::RowType as TupleMut>::Mut<'_>

Source§

impl<Idx, T1: TupleIndexMut<Idx>, T2: TupleIndexMut<Idx>, T3: TupleIndexMut<Idx>, T4: TupleIndexMut<Idx>, T5: TupleIndexMut<Idx>> TupleRowMut<Idx> for (T1, T2, T3, T4, T5)

Source§

fn tuple_row_mut(&mut self) -> <Self::RowType as TupleMut>::Mut<'_>

Source§

impl<Idx, T1: TupleIndexMut<Idx>, T2: TupleIndexMut<Idx>, T3: TupleIndexMut<Idx>, T4: TupleIndexMut<Idx>> TupleRowMut<Idx> for (T1, T2, T3, T4)

Source§

fn tuple_row_mut(&mut self) -> <Self::RowType as TupleMut>::Mut<'_>

Source§

impl<Idx, T1: TupleIndexMut<Idx>, T2: TupleIndexMut<Idx>, T3: TupleIndexMut<Idx>> TupleRowMut<Idx> for (T1, T2, T3)

Source§

fn tuple_row_mut(&mut self) -> <Self::RowType as TupleMut>::Mut<'_>

Source§

impl<Idx, T1: TupleIndexMut<Idx>, T2: TupleIndexMut<Idx>> TupleRowMut<Idx> for (T1, T2)

Source§

fn tuple_row_mut(&mut self) -> <Self::RowType as TupleMut>::Mut<'_>

Source§

impl<Idx, T1: TupleIndexMut<Idx>> TupleRowMut<Idx> for (T1,)

Source§

fn tuple_row_mut(&mut self) -> <Self::RowType as TupleMut>::Mut<'_>

Source§

impl<Idx> TupleRowMut<Idx> for ()

Source§

fn tuple_row_mut(&mut self) -> <Self::RowType as TupleMut>::Mut<'_>

Implementors§