Skip to content

Commit adab617

Browse files
Renamed Row into TupleRow
1 parent e314d85 commit adab617

6 files changed

Lines changed: 28 additions & 23 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
- `TupleTryFrom<T, E>` and `TupleTryInto<U, E>` traits for fallible conversions between tuples where elements implement `TryFrom`/`TryInto`
1919
- `TupleFrom<T>` and `TupleInto<U>` traits for infallible conversions between tuples where elements implement `From`/`Into`
2020
- Support for tuple conversions with proper error handling and type safety
21-
- `Row<Idx>` and `RowMut<Idx>` traits for indexing rows in tuples of tuples
21+
- `TupleRow<Idx>` and `TupleRowMut<Idx>` traits for indexing rows in tuples of tuples
22+
23+
### Changed in Unreleased
24+
25+
- Renamed `Row` and `RowMut` traits to `TupleRow` and `TupleRowMut` respectively to avoid naming collisions
26+
- Renamed `row()` and `row_mut()` methods to `tuple_row()` and `tuple_row_mut()` for consistency
2227

2328
## [0.1.0] - 2025-12-05
2429

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ The library provides several traits for working with tuples:
4848
- [`SingletonTuple`](https://docs.rs/tuplities-len/latest/tuplities_len/trait.SingletonTuple.html): A marker trait implemented for single-element tuples `(T,)` with `TupleLen<Idx = U1>`.
4949
- [`TupleIndex<Idx>`](https://docs.rs/tuplities-index/latest/tuplities_index/trait.TupleIndex.html): Provides an [`index()`](https://docs.rs/tuplities-index/latest/tuplities_index/trait.TupleIndex.html#tymethod.index) method to access the element at the specified index [`typenum`](https://docs.rs/typenum/latest/typenum/)'s `Idx` of the tuple.
5050
- [`TupleIndexMut<Idx>`](https://docs.rs/tuplities-index/latest/tuplities_index/trait.TupleIndexMut.html): Provides an [`index_mut()`](https://docs.rs/tuplities-index/latest/tuplities_index/trait.TupleIndexMut.html#tymethod.index_mut) method to access a mutable reference to the element at the specified index [`typenum`](https://docs.rs/typenum/latest/typenum/)'s `Idx` of the tuple.
51-
- [`Row<Idx>`](https://docs.rs/tuplities-row/latest/tuplities_row/trait.Row.html): Provides a [`row()`](https://docs.rs/tuplities-row/latest/tuplities_row/trait.Row.html#tymethod.row) method to access elements at the specified index across all tuples in a tuple of tuples (row-wise indexing).
52-
- [`RowMut<Idx>`](https://docs.rs/tuplities-row/latest/tuplities_row/trait.RowMut.html): Provides a [`row_mut()`](https://docs.rs/tuplities-row/latest/tuplities_row/trait.RowMut.html#tymethod.row_mut) method to access mutable elements at the specified index across all tuples in a tuple of tuples (mutable row-wise indexing).
51+
- [`TupleRow<Idx>`](https://docs.rs/tuplities-row/latest/tuplities_row/trait.TupleRow.html): Provides a [`tuple_row()`](https://docs.rs/tuplities-row/latest/tuplities_row/trait.TupleRow.html#tymethod.tuple_row) method to access elements at the specified index across all tuples in a tuple of tuples (row-wise indexing).
52+
- [`TupleRowMut<Idx>`](https://docs.rs/tuplities-row/latest/tuplities_row/trait.TupleRowMut.html): Provides a [`tuple_row_mut()`](https://docs.rs/tuplities-row/latest/tuplities_row/trait.TupleRowMut.html#tymethod.tuple_row_mut) method to access mutable elements at the specified index across all tuples in a tuple of tuples (mutable row-wise indexing).
5353

5454
## Features
5555

tuplities-derive/src/tuplities_row.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
//! Submodule providing the derive macro for the `Row` trait.
1+
//! Submodule providing the derive macro for the `TupleRow` trait.
22
33
use quote::quote;
44

55
use crate::tuple_size::{generate_all_sizes, indices, type_params};
66

7-
/// Generate `Row` trait implementations for all tuple sizes.
7+
/// Generate `TupleRow` trait implementations for all tuple sizes.
88
pub fn impl_row() -> proc_macro2::TokenStream {
99
generate_all_sizes(|size| {
1010
let type_params = type_params(size);
1111
let indices = indices(size);
1212

1313
quote! {
14-
impl<Idx: typenum::Unsigned, #(#type_params: tuplities_index::TupleIndex<Idx>,)*> Row<Idx> for (#(#type_params,)*)
14+
impl<Idx: typenum::Unsigned, #(#type_params: tuplities_index::TupleIndex<Idx>,)*> TupleRow<Idx> for (#(#type_params,)*)
1515
{
1616
type RowType = (#(#type_params::Type,)*);
1717

18-
fn row(&self) -> <Self::RowType as tuplities_ref::TupleRef>::Ref<'_> {
18+
fn tuple_row(&self) -> <Self::RowType as tuplities_ref::TupleRef>::Ref<'_> {
1919
(#(self.#indices.tuple_index(),)*)
2020
}
2121
}

tuplities-derive/src/tuplities_row_mut.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
//! Submodule providing the derive macro for the `RowMut` trait.
1+
//! Submodule providing the derive macro for the `TupleRowMut` trait.
22
33
use quote::quote;
44

55
use crate::tuple_size::{generate_all_sizes, indices, type_params};
66

7-
/// Generate `RowMut` trait implementations for all tuple sizes.
7+
/// Generate `TupleRowMut` trait implementations for all tuple sizes.
88
pub fn impl_row_mut() -> proc_macro2::TokenStream {
99
generate_all_sizes(|size| {
1010
let type_params = type_params(size);
1111
let indices = indices(size);
1212

1313
quote! {
14-
impl<Idx: typenum::Unsigned, #(#type_params: tuplities_index::TupleIndexMut<Idx>,)*> RowMut<Idx> for (#(#type_params,)*)
14+
impl<Idx: typenum::Unsigned, #(#type_params: tuplities_index::TupleIndexMut<Idx>,)*> TupleRowMut<Idx> for (#(#type_params,)*)
1515
{
16-
fn row_mut(&mut self) -> <Self::RowType as tuplities_mut::TupleMut>::Mut<'_> {
16+
fn tuple_row_mut(&mut self) -> <Self::RowType as tuplities_mut::TupleMut>::Mut<'_> {
1717
(#(self.#indices.tuple_index_mut(),)*)
1818
}
1919
}

tuplities-row/src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![no_std]
22

3-
//! [tuplities](https://github.com/lucacappelletti94/tuplities) suite crate providing the `Row` and `RowMut` traits.
3+
//! [tuplities](https://github.com/lucacappelletti94/tuplities) suite crate providing the `TupleRow` and `TupleRowMut` traits.
44
55
use tuplities_len::TupleLen;
66
use tuplities_mut::TupleMut;
@@ -9,46 +9,46 @@ use tuplities_ref::TupleRef;
99
/// A trait for indexing rows in tuples of tuples.
1010
///
1111
/// This trait allows accessing elements at a specific index across all tuples in a tuple of tuples.
12-
/// For a tuple of tuples like `((A, B), (C, D))`, `Row<U0>` would return `(&A, &C)` and `Row<U1>` would return `(&B, &D)`.
12+
/// For a tuple of tuples like `((A, B), (C, D))`, `TupleRow<U0>` would return `(&A, &C)` and `TupleRow<U1>` would return `(&B, &D)`.
1313
///
1414
/// Each inner tuple must implement `TupleIndex<Idx>`, and the returned row tuple implements `TupleRef`.
1515
///
1616
/// # Examples
1717
///
1818
/// ```
19-
/// use tuplities_row::Row;
19+
/// use tuplities_row::TupleRow;
2020
/// use typenum::U0;
2121
///
2222
/// let matrix = ((1, 2), (3, 4), (5, 6));
23-
/// let first_row = Row::<U0>::row(&matrix);
23+
/// let first_row = TupleRow::<U0>::tuple_row(&matrix);
2424
/// assert_eq!(first_row, (&1, &3, &5));
2525
/// ```
2626
///
2727
/// Part of the [`tuplities`](https://docs.rs/tuplities/latest/tuplities/) crate.
2828
#[tuplities_derive::impl_row]
29-
pub trait Row<Idx: typenum::Unsigned>: TupleLen {
29+
pub trait TupleRow<Idx: typenum::Unsigned>: TupleLen {
3030
/// The type of the row tuple containing elements at index `Idx`.
3131
type RowType: TupleRef + TupleLen<Idx = <Self as TupleLen>::Idx>;
3232

3333
/// Returns a tuple of references to the elements at index `Idx` in each inner tuple.
34-
fn row(&self) -> <Self::RowType as TupleRef>::Ref<'_>;
34+
fn tuple_row(&self) -> <Self::RowType as TupleRef>::Ref<'_>;
3535
}
3636

3737
/// A trait for mutable indexing rows in tuples of tuples.
3838
///
3939
/// This trait allows mutable access to elements at a specific index across all tuples in a tuple of tuples.
40-
/// For a tuple of tuples like `((A, B), (C, D))`, `RowMut<U0>` would return `(&mut A, &mut C)` and `RowMut<U1>` would return `(&mut B, &mut D)`.
40+
/// 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)`.
4141
///
4242
/// Each inner tuple must implement `TupleIndexMut<Idx>`, and the returned row tuple implements `TupleMut`.
4343
///
4444
/// # Examples
4545
///
4646
/// ```
47-
/// use tuplities_row::RowMut;
47+
/// use tuplities_row::TupleRowMut;
4848
/// use typenum::U0;
4949
///
5050
/// let mut matrix = ((1, 2), (3, 4), (5, 6));
51-
/// let first_row = RowMut::<U0>::row_mut(&mut matrix);
51+
/// let first_row = TupleRowMut::<U0>::tuple_row_mut(&mut matrix);
5252
/// *first_row.0 = 10;
5353
/// *first_row.1 = 30;
5454
/// *first_row.2 = 50;
@@ -57,7 +57,7 @@ pub trait Row<Idx: typenum::Unsigned>: TupleLen {
5757
///
5858
/// Part of the [`tuplities`](https://docs.rs/tuplities/latest/tuplities/) crate.
5959
#[tuplities_derive::impl_row_mut]
60-
pub trait RowMut<Idx: typenum::Unsigned>: Row<Idx, RowType: TupleMut> {
60+
pub trait TupleRowMut<Idx: typenum::Unsigned>: TupleRow<Idx, RowType: TupleMut> {
6161
/// Returns a tuple of mutable references to the elements at index `Idx` in each inner tuple.
62-
fn row_mut(&mut self) -> <Self::RowType as TupleMut>::Mut<'_>;
62+
fn tuple_row_mut(&mut self) -> <Self::RowType as TupleMut>::Mut<'_>;
6363
}

tuplities/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub mod prelude {
2626
pub use tuplities_remove::TupleRemove;
2727
pub use tuplities_replicate::TupleReplicate;
2828
pub use tuplities_reverse::TupleReverse;
29-
pub use tuplities_row::{Row, RowMut};
29+
pub use tuplities_row::{TupleRow, TupleRowMut};
3030
pub use tuplities_split::TupleSplit;
3131
pub use tuplities_try_from::{TupleTryFrom, TupleTryInto};
3232
}

0 commit comments

Comments
 (0)