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§
Sourcefn tuple_row_mut(&mut self) -> <Self::RowType as TupleMut>::Mut<'_>
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.