pub trait JoinCycle {
// Required methods
fn add_joined_edges<Es>(&self, edges: Es, services: &mut Services) -> Self
where Es: IntoIterator<Item = (Handle<HalfEdge>, Curve, [Point<1>; 2])>,
Es::IntoIter: Clone + ExactSizeIterator;
fn join_to(
&self,
other: &Cycle,
range: RangeInclusive<usize>,
other_range: RangeInclusive<usize>,
services: &mut Services,
) -> Self;
}Expand description
Join a Cycle to another
Required Methods§
Sourcefn add_joined_edges<Es>(&self, edges: Es, services: &mut Services) -> Selfwhere
Es: IntoIterator<Item = (Handle<HalfEdge>, Curve, [Point<1>; 2])>,
Es::IntoIter: Clone + ExactSizeIterator,
fn add_joined_edges<Es>(&self, edges: Es, services: &mut Services) -> Selfwhere
Es: IntoIterator<Item = (Handle<HalfEdge>, Curve, [Point<1>; 2])>,
Es::IntoIter: Clone + ExactSizeIterator,
Create a cycle that is joined to the provided edges
Sourcefn join_to(
&self,
other: &Cycle,
range: RangeInclusive<usize>,
other_range: RangeInclusive<usize>,
services: &mut Services,
) -> Self
fn join_to( &self, other: &Cycle, range: RangeInclusive<usize>, other_range: RangeInclusive<usize>, services: &mut Services, ) -> Self
Join the cycle to another
Joins the cycle to the other at the provided ranges. The ranges specify the indices of the half-edges that are joined together.
A modulo operation is applied to all indices before use, so in a cycle
of 3 half-edges, indices 0 and 3 refer to the same half-edge. This
allows for specifying a range that crosses the “seam” of the cycle.
§Panics
Panics, if the ranges have different lengths.
§Implementation Note
The use of the RangeInclusive type might be a bit limiting, as other
range types might be more convenient in a given use case. This
implementation was chosen for now, as it wasn’t clear whether the
additional complexity of using RangeBounds would be worth it.
A solution based on SliceIndex could theoretically be used, but that
trait is partially unstable. In addition, it’s not clear how it could be
used generically, as it could yield a range (which can be iterated over)
or a single item (which can not). This is not a hard problem in
principle (a single item could just be an iterator of length 1), but I
don’t see it how to address this in Rust in a reasonable way.
Maybe a custom trait that is implemented for usize and all range types
would be the best solution.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.