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:
Hanno Braun 2022-11-08 12:12:57 +01:00
parent 2dd2c916eb
commit 28b2377eb8
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,5 @@
use std::slice;
use fj_interop::ext::SliceExt;
use fj_math::{Scalar, Winding};
use pretty_assertions::assert_eq;
@ -76,7 +78,7 @@ impl 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()
}
@ -138,3 +140,8 @@ impl Cycle {
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>>;

View File

@ -85,7 +85,7 @@ mod vertex;
pub use self::{
curve::{Curve, GlobalCurve},
cycle::Cycle,
cycle::{Cycle, HalfEdgesOfCycle},
edge::{GlobalEdge, HalfEdge, VerticesInNormalizedOrder},
face::{Face, FaceSet, Handedness},
shell::Shell,