Skip to content

Commit e50d865

Browse files
mariusaefacebook-github-bot
authored andcommitted
ndslice -> ViewExt::partition -> ViewExt::group_by (#760)
Summary: Pull Request resolved: #760 TSIA. Better name. Reviewed By: shayne-fletcher Differential Revision: D79568682 fbshipit-source-id: dbd3104a54237570ae15b73aebf9536d65e8fe47
1 parent c750074 commit e50d865

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ndslice/src/view.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ pub trait ViewExt: Viewable {
491491
/// ```
492492
fn range<R: Into<Range>>(&self, dim: &str, range: R) -> Result<View, ViewError>;
493493

494-
/// Partition the view on `dim`. The returned iterator enumerates all partitions
494+
/// Group by view on `dim`. The returned iterator enumerates all groups
495495
/// as views in the extent of `dim` to the last dimension of the view.
496496
///
497497
/// ## Examples
@@ -503,9 +503,9 @@ pub trait ViewExt: Viewable {
503503
/// let ext = extent!(zone = 4, host = 2, gpu = 8);
504504
///
505505
/// // We generate one view for each zone.
506-
/// assert_eq!(ext.partition("host").unwrap().count(), 4);
506+
/// assert_eq!(ext.group_by("host").unwrap().count(), 4);
507507
///
508-
/// let mut parts = ext.partition("host").unwrap();
508+
/// let mut parts = ext.group_by("host").unwrap();
509509
///
510510
/// let zone0 = parts.next().unwrap();
511511
/// let mut zone0_points = zone0.iter();
@@ -526,7 +526,7 @@ pub trait ViewExt: Viewable {
526526
/// (extent!(host = 2, gpu = 8).point(vec![0, 0]).unwrap(), 16)
527527
/// );
528528
/// ```
529-
fn partition(&self, dim: &str) -> Result<impl Iterator<Item = View>, ViewError>;
529+
fn group_by(&self, dim: &str) -> Result<impl Iterator<Item = View>, ViewError>;
530530
}
531531

532532
impl<T: Viewable> ViewExt for T {
@@ -558,7 +558,7 @@ impl<T: Viewable> ViewExt for T {
558558
})
559559
}
560560

561-
fn partition(&self, dim: &str) -> Result<impl Iterator<Item = View>, ViewError> {
561+
fn group_by(&self, dim: &str) -> Result<impl Iterator<Item = View>, ViewError> {
562562
let dim = self
563563
.labels()
564564
.iter()
@@ -853,10 +853,10 @@ mod test {
853853
fn test_iter_subviews() {
854854
let extent = extent!(zone = 4, host = 4, gpu = 8);
855855

856-
assert_eq!(extent.partition("gpu").unwrap().count(), 16);
857-
assert_eq!(extent.partition("zone").unwrap().count(), 1);
856+
assert_eq!(extent.group_by("gpu").unwrap().count(), 16);
857+
assert_eq!(extent.group_by("zone").unwrap().count(), 1);
858858

859-
let mut parts = extent.partition("gpu").unwrap();
859+
let mut parts = extent.group_by("gpu").unwrap();
860860
assert_view!(
861861
parts.next().unwrap(),
862862
extent!(gpu = 8),

0 commit comments

Comments
 (0)