pub trait IteratorExt: Iterator + Sized {
    fn perimeter(self) -> Perimeter<Self>Notable traits for Perimeter<I>impl<I> Iterator for Perimeter<I> where
    I: Iterator,
    I::Item: Clone
type Item = (I::Item, I::Item);

        Self::Item: Clone
, { ... } fn keys(self) -> Keys<Self>Notable traits for Keys<I>impl<I> Iterator for Keys<I> where
    I: Iterator,
    I::Item: ClosedView
type Item = <I::Item as ClosedView>::Key;

        Self::Item: ClosedView
, { ... } fn has_at_least(self, n: usize) -> Option<MultiPeek<Self>> { ... } fn has_exactly(self, n: usize) -> Option<MultiPeek<Self>> { ... } fn try_collect<T>(self) -> Result<T, T::Error>
        T: TryFromIterator<Self::Item>
, { ... } }
Expand description

Extension methods for types implementing Iterator.

Provided Methods

Provides an iterator over a window of duplets that includes the first item in the sequence at both the beginning and end of the iteration.

Given a collection of ordered items $(a,b,c)$, this iterator yeilds the ordered items $((a,b),(b,c),(c,a))$.

Maps an iterator over graph views to the keys of those views.

It is often useful to examine or collect the keys of views over a MeshGraph. This iterator avoids redundant use of map to extract keys.


Collecting keys of faces before a topological mutation in a MeshGraph:

use decorum::R64;
use nalgebra::Point3;
use plexus::graph::MeshGraph;
use plexus::prelude::*;
use plexus::primitive::generate::Position;
use plexus::primitive::sphere::UvSphere;

type E3 = Point3<R64>;

let mut graph = UvSphere::new(6, 6)

let keys = graph
    .filter(|face| face.arity() > 3)
for key in keys {

Determines if an iterator provides n or more items.

Returns a peekable iterator if the source iterator provides at least n items, otherwise None.


Ensuring that an iterator over vertices has an arity of at least three:

use plexus::IteratorExt;

fn is_convex(vertices: impl Iterator<Item = [f64; 2]>) -> bool {
        .and_then(|vertices| {
            for vertex in vertices {
                // ...
            // ...