aboutsummaryrefslogtreecommitdiff
path: root/src/coord/ranged1d/combinators/nested.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/coord/ranged1d/combinators/nested.rs')
-rw-r--r--src/coord/ranged1d/combinators/nested.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/coord/ranged1d/combinators/nested.rs b/src/coord/ranged1d/combinators/nested.rs
index d23f34e..e4a493e 100644
--- a/src/coord/ranged1d/combinators/nested.rs
+++ b/src/coord/ranged1d/combinators/nested.rs
@@ -113,7 +113,7 @@ impl<P: DiscreteRanged, S: Ranged> Ranged for NestedRange<P, S> {
self.primary
.values()
.enumerate()
- .map(|(idx, val)| {
+ .flat_map(|(idx, val)| {
std::iter::once(NestedValue::Category(val)).chain(
self.secondary[idx]
.key_points(secondary_size)
@@ -123,7 +123,6 @@ impl<P: DiscreteRanged, S: Ranged> Ranged for NestedRange<P, S> {
}),
)
})
- .flatten()
.collect()
}
}
@@ -160,10 +159,12 @@ impl<P: DiscreteRanged, S: DiscreteRanged> DiscreteRanged for NestedRange<P, S>
}
}
+/// Used to build a nested coordinate system.
pub trait BuildNestedCoord: AsRangedCoord
where
Self::CoordDescType: DiscreteRanged,
{
+ /// Builds a nested coordinate system.
fn nested_coord<S: AsRangedCoord>(
self,
builder: impl Fn(<Self::CoordDescType as Ranged>::ValueType) -> S,