pub mod then;
pub mod facet;
pub mod map;
pub use facet::{facet, Facet};
pub use map::{map, Map};
use then::Then;
#[cfg(feature = "std")]
pub use facet::{facet_map, FacetMap};
pub trait Operator<I> {
type Output;
fn next(&mut self, input: I) -> Self::Output;
}
pub trait OperatorExt<I>: Operator<I> {
fn then<P2>(self, other: P2) -> Then<I, Self, P2>
where
Self: Sized,
P2: Operator<Self::Output>,
{
Then(self, other, core::marker::PhantomData::default())
}
fn facet<P2>(self, other: P2) -> Facet<I, Self, P2>
where
Self: Sized,
P2: Operator<I>,
{
facet(self, other)
}
fn map<O, F>(self, f: F) -> Then<I, Self, Map<F>>
where
Self: Sized,
F: FnMut(Self::Output) -> O,
{
self.then(map(f))
}
}
impl<I, T: Operator<I>> OperatorExt<I> for T {}