Trait handy_io::pattern::Pattern [] [src]

pub trait Pattern: Sized {
    type Value;
    fn then<F, P>(self, f: F) -> Then<Self, F>
    where
        F: FnOnce(Result<Self::Value>) -> P
, { ... } fn and_then<F, P>(self, f: F) -> AndThen<Self, F>
    where
        F: FnOnce(Self::Value) -> P
, { ... } fn or_else<F, P>(self, f: F) -> OrElse<Self, F>
    where
        F: FnOnce(Error) -> P
, { ... } fn map<F, T>(self, f: F) -> Map<Self, F>
    where
        F: FnOnce(Self::Value) -> T
, { ... } fn chain<P>(self, other: P) -> Chain<Self, P>
    where
        P: Pattern
, { ... } fn repeat(self) -> Repeat<Self>
    where
        Self: Clone
, { ... } }

Pattern.

Associated Types

The value type associated to the pattern.

Provided Methods

Takes a closure which maps a Result<Self::Value> to a pattern, and creates a pattern which calls that closure on the evaluation result of self.

Takes a closure which maps a value to a pattern, and creates a pattern which calls that closure if the evaluation of self was succeeded.

Takes a closure which maps an error to a pattern, and creates a pattern which calls that closure if the evaluation of self failed.

Takes a closure which maps a value to another value, and creates a pattern which calls that closure on the evaluated value of self.

Takes two patterns and creates a new pattern over both in sequence.

In generally, using the tuple pattern (self, P) is more convenient way to achieve the same effect.

Creates Repeat pattern to represent an infinite stream of this pattern.

Implementors