Struct handy_async::pattern::BoxPattern
[−]
[src]
pub struct BoxPattern<M: Matcher, T>(_);
Boxed pattern.
Trait Implementations
impl<M: Matcher, T> Pattern for BoxPattern<M, T>
[src]
type Value = T
The value type associated to the pattern.
fn then<F, P, E>(self, f: F) -> Then<Self, F, E> where F: FnOnce(Result<Self::Value, E>) -> P
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
. Read more
fn and_then<F, P>(self, f: F) -> AndThen<Self, F> where F: FnOnce(Self::Value) -> P
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. Read more
fn or_else<F, P, E>(self, f: F) -> OrElse<Self, F, E> where F: FnOnce(E) -> P
Takes a closure which maps an error to a pattern, and creates a pattern which calls that closure if the evaluation of self
failed. Read more
fn or<P>(self, other: P) -> Or<Self, P> where P: Pattern<Value=Self::Value>
Takes a pattern other
which will be used if the evaluation of self
is failed.
fn map<F, T>(self, f: F) -> Map<Self, F> where F: FnOnce(Self::Value) -> T
Takes a closure which maps a value to another value, and creates a pattern which calls that closure on the evaluated value of self
. Read more
fn chain<P>(self, other: P) -> Chain<Self, P> where P: Pattern
Takes two patterns and creates a new pattern over both in sequence. Read more
fn repeat(self) -> Repeat<Self> where Self: Clone
Creates Repeat
pattern to represent an infinite stream of this pattern.
fn expect_eq(self, expected_value: Self::Value) -> Expect<Self> where Self::Value: PartialEq
Takes an expected value and creates a pattern which performs a pattern matching and validates that the matched value is equal to the expected one. Read more
fn boxed<M: Matcher>(self) -> BoxPattern<M, Self::Value> where Self: AsyncMatch<M> + 'static, Self::Future: Send + 'static
Returnes a boxed pattern to match with a matcher M
.
impl<M: Matcher, T> AsyncMatch<M> for BoxPattern<M, T>
[src]
type Future = BoxFuture<(M, T), AsyncError<M, M::Error>>
The future type which will produce a value Self::Value
by matching this pattern and a matcher M
. Read more
fn async_match(self, matcher: M) -> Self::Future
Creates a future which will produce a Self::Value
by matching this pattern and the matcher
. Read more
fn into_stream(self, matcher: M) -> MatchStream<M, Self> where Self: Clone
Consumes this pattern and the matcher
, returning a stream which will produce a sequence of matched values. Read more