Struct Optional

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

A pipe that wraps another pipe’s IO in an Option.

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

Implementations§

Source§

impl<P: Pipe> Optional<P>

Source

pub fn new(pipe: P) -> Self

Create a new optional pipe.

Trait Implementations§

Source§

impl<P> Pipe for Optional<P>
where P: Pipe,

Source§

type InputItem = Option<<P as Pipe>::InputItem>

The type of input this pipe accepts.
Source§

type OutputItem = Option<<P as Pipe>::OutputItem>

The type of output this pipe produces.
Source§

fn next(&mut self, item: Option<P::InputItem>) -> Option<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 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 for Optional<P>
where P: ResetablePipe,

Source§

fn reset(&mut self)

Reset the state of the pipe. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<P> UnwindSafe for Optional<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.