Skip to content

Commit 078c3d8

Browse files
committed
API: Rename .genrows/gencolumns/_mut into .rows/columns/_mut
Rename these to give them clearer names. Rows is for rows (and generalized rows, which is a bit strange). Columns is for columns (and generalized ones). Generalized just means that we take the concept of rows/columns and somehow extend it to n-dimension arrays. The old names .genrows/gencolums/_mut are deprecated
1 parent 1912bd9 commit 078c3d8

File tree

1 file changed

+48
-8
lines changed

1 file changed

+48
-8
lines changed

src/impl_methods.rs

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -811,12 +811,12 @@ where
811811
/// [[ 6, 7, 8], // -- row 1, 0
812812
/// [ 9, 10, 11]]]); // -- row 1, 1
813813
///
814-
/// // `genrows` will yield the four generalized rows of the array.
815-
/// for row in a.genrows() {
814+
/// // `rows` will yield the four generalized rows of the array.
815+
/// for row in a.rows() {
816816
/// /* loop body */
817817
/// }
818818
/// ```
819-
pub fn genrows(&self) -> Lanes<'_, A, D::Smaller>
819+
pub fn rows(&self) -> Lanes<'_, A, D::Smaller>
820820
where
821821
S: Data,
822822
{
@@ -827,11 +827,19 @@ where
827827
Lanes::new(self.view(), Axis(n - 1))
828828
}
829829

830+
#[deprecated(note="Renamed to .rows()", since="0.15.0")]
831+
pub fn genrows(&self) -> Lanes<'_, A, D::Smaller>
832+
where
833+
S: Data,
834+
{
835+
self.rows()
836+
}
837+
830838
/// Return a producer and iterable that traverses over the *generalized*
831839
/// rows of the array and yields mutable array views.
832840
///
833841
/// Iterator element is `ArrayView1<A>` (1D read-write array view).
834-
pub fn genrows_mut(&mut self) -> LanesMut<'_, A, D::Smaller>
842+
pub fn rows_mut(&mut self) -> LanesMut<'_, A, D::Smaller>
835843
where
836844
S: DataMut,
837845
{
@@ -842,6 +850,14 @@ where
842850
LanesMut::new(self.view_mut(), Axis(n - 1))
843851
}
844852

853+
#[deprecated(note="Renamed to .rows_mut()", since="0.15.0")]
854+
pub fn genrows_mut(&mut self) -> LanesMut<'_, A, D::Smaller>
855+
where
856+
S: DataMut,
857+
{
858+
self.rows_mut()
859+
}
860+
845861
/// Return a producer and iterable that traverses over the *generalized*
846862
/// columns of the array. For a 2D array these are the regular columns.
847863
///
@@ -863,29 +879,53 @@ where
863879
/// let a = arr3(&[[[ 0, 1, 2], [ 3, 4, 5]],
864880
/// [[ 6, 7, 8], [ 9, 10, 11]]]);
865881
///
866-
/// // Here `gencolumns` will yield the six generalized columns of the array.
867-
/// for row in a.gencolumns() {
882+
/// // Here `columns` will yield the six generalized columns of the array.
883+
/// for row in a.columns() {
868884
/// /* loop body */
869885
/// }
870886
/// ```
871-
pub fn gencolumns(&self) -> Lanes<'_, A, D::Smaller>
887+
pub fn columns(&self) -> Lanes<'_, A, D::Smaller>
872888
where
873889
S: Data,
874890
{
875891
Lanes::new(self.view(), Axis(0))
876892
}
877893

894+
/// Return a producer and iterable that traverses over the *generalized*
895+
/// columns of the array. For a 2D array these are the regular columns.
896+
///
897+
/// Renamed to `.columns()`
898+
#[deprecated(note="Renamed to .columns()", since="0.15.0")]
899+
pub fn gencolumns(&self) -> Lanes<'_, A, D::Smaller>
900+
where
901+
S: Data,
902+
{
903+
self.columns()
904+
}
905+
878906
/// Return a producer and iterable that traverses over the *generalized*
879907
/// columns of the array and yields mutable array views.
880908
///
881909
/// Iterator element is `ArrayView1<A>` (1D read-write array view).
882-
pub fn gencolumns_mut(&mut self) -> LanesMut<'_, A, D::Smaller>
910+
pub fn columns_mut(&mut self) -> LanesMut<'_, A, D::Smaller>
883911
where
884912
S: DataMut,
885913
{
886914
LanesMut::new(self.view_mut(), Axis(0))
887915
}
888916

917+
/// Return a producer and iterable that traverses over the *generalized*
918+
/// columns of the array and yields mutable array views.
919+
///
920+
/// Renamed to `.columns_mut()`
921+
#[deprecated(note="Renamed to .columns_mut()", since="0.15.0")]
922+
pub fn gencolumns_mut(&mut self) -> LanesMut<'_, A, D::Smaller>
923+
where
924+
S: DataMut,
925+
{
926+
self.columns_mut()
927+
}
928+
889929
/// Return a producer and iterable that traverses over all 1D lanes
890930
/// pointing in the direction of `axis`.
891931
///

0 commit comments

Comments
 (0)