Struct Enumerate

Source
pub struct Enumerate<P>
where P: Pipe,
{ /* private fields */ }
Expand description

A pipe that enumerates the output items of another pipe.

The inputs of this pipe are the same as the wrapped ones, but it’s output item is a tuple of an index and the wrapped pipe’s output. The index starts with zero and counts up for every produces output item.

For more information, please see the documentation of the enumerate method.

Implementations§

Source§

impl<P: Pipe> Enumerate<P>

Source

pub fn new(pipe: P) -> Self

Create a new enumerating pipe.

Trait Implementations§

Source§

impl<P: Pipe> Pipe for Enumerate<P>

Source§

type InputItem = <P as Pipe>::InputItem

The type of input this pipe accepts.
Source§

type OutputItem = (usize, <P as Pipe>::OutputItem)

The type of output this pipe produces.
Source§

fn next(&mut self, item: P::InputItem) -> (usize, P::OutputItem)

Calculate the next output item, based on an input item.
Source§

fn bypass(self) -> Bypass<Self>
where Self: Sized, Self::InputItem: Clone,

Create a bypassed version of the pipe. Read more
Source§

fn compose(self) -> Composed<Self>
where Self: Sized,

Create a composable pipe. Read more
Source§

fn connect<O: Pipe<InputItem = Self::OutputItem>>( self, other: O, ) -> Connector<Self, O>
where Self: Sized,

Connect two pipes. Read more
Source§

fn into_iter(self) -> IterPipe<Self>
where Self::InputItem: Default, Self: Sized + Pipe<InputItem = ()>,

Wrap the pipe into an iterator. Read more
Source§

fn optional(self) -> Optional<Self>
where Self: Sized,

Optionalize the pipe. Read more
Source§

fn enumerate(self) -> Enumerate<Self>
where Self: Sized,

Enumerate the output items of a pipe. Read more
Source§

fn boxed( self, ) -> Box<dyn Pipe<InputItem = Self::InputItem, OutputItem = Self::OutputItem>>
where Self: Sized + 'static,

Create a boxed trait object of the pipe. Read more
Source§

impl<P: ResetablePipe> ResetablePipe for Enumerate<P>

Source§

fn reset(&mut self)

Reset the state of the pipe. Read more

Auto Trait Implementations§

§

impl<P> Freeze for Enumerate<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for Enumerate<P>
where P: RefUnwindSafe,

§

impl<P> Send for Enumerate<P>
where P: Send,

§

impl<P> Sync for Enumerate<P>
where P: Sync,

§

impl<P> Unpin for Enumerate<P>
where P: Unpin,

§

impl<P> UnwindSafe for Enumerate<P>
where P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.