mirror of https://github.com/hannobraun/Fornjot
Use concrete type as return value
I'm currently writing some code that requires more from that type than just `Iterator`. Using a concrete type seems more practical than specifying all kinds of additional bounds.
This commit is contained in:
parent
2dd2c916eb
commit
28b2377eb8
|
@ -1,3 +1,5 @@
|
||||||
|
use std::slice;
|
||||||
|
|
||||||
use fj_interop::ext::SliceExt;
|
use fj_interop::ext::SliceExt;
|
||||||
use fj_math::{Scalar, Winding};
|
use fj_math::{Scalar, Winding};
|
||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
|
@ -76,7 +78,7 @@ impl Cycle {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access the half-edges that make up the cycle
|
/// Access the half-edges that make up the cycle
|
||||||
pub fn half_edges(&self) -> impl Iterator<Item = &Handle<HalfEdge>> + '_ {
|
pub fn half_edges(&self) -> HalfEdgesOfCycle {
|
||||||
self.half_edges.iter()
|
self.half_edges.iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,3 +140,8 @@ impl Cycle {
|
||||||
unreachable!("Encountered invalid cycle: {self:#?}");
|
unreachable!("Encountered invalid cycle: {self:#?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// An iterator over the half-edges of a [`Cycle`]
|
||||||
|
///
|
||||||
|
/// Returned by [`Cycle::half_edges`].
|
||||||
|
pub type HalfEdgesOfCycle<'a> = slice::Iter<'a, Handle<HalfEdge>>;
|
||||||
|
|
|
@ -85,7 +85,7 @@ mod vertex;
|
||||||
|
|
||||||
pub use self::{
|
pub use self::{
|
||||||
curve::{Curve, GlobalCurve},
|
curve::{Curve, GlobalCurve},
|
||||||
cycle::Cycle,
|
cycle::{Cycle, HalfEdgesOfCycle},
|
||||||
edge::{GlobalEdge, HalfEdge, VerticesInNormalizedOrder},
|
edge::{GlobalEdge, HalfEdge, VerticesInNormalizedOrder},
|
||||||
face::{Face, FaceSet, Handedness},
|
face::{Face, FaceSet, Handedness},
|
||||||
shell::Shell,
|
shell::Shell,
|
||||||
|
|
Loading…
Reference in New Issue