pub struct Then<P, F, E>(/* private fields */);Expand description
A pattern for the then combinator,
chaining a pattern on the end of another pattern regardless of its evaluation result.
This pattern is created by calling Pattern::then method.
Implementations§
Trait Implementations§
Source§impl<P0, P1, F, E> Pattern for Then<P0, F, E>
impl<P0, P1, F, E> Pattern for Then<P0, F, E>
Source§fn then<F, P, E>(self, f: F) -> Then<Self, F, E>
fn then<F, P, E>(self, f: F) -> Then<Self, F, E>
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.Source§fn and_then<F, P>(self, f: F) -> AndThen<Self, F>
fn and_then<F, P>(self, f: F) -> AndThen<Self, F>
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.Source§fn or_else<F, P, E>(self, f: F) -> OrElse<Self, F, E>where
F: FnOnce(E) -> P,
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.Source§fn or<P>(self, other: P) -> Or<Self, P>
fn or<P>(self, other: P) -> Or<Self, P>
Takes a pattern
other which will be used if the evaluation of self is failed.Source§fn map<F, T>(self, f: F) -> Map<Self, F>
fn map<F, T>(self, f: F) -> Map<Self, F>
Takes a closure which maps a value to another value, and
creates a pattern which calls that closure on the evaluated value of
self.Source§fn chain<P>(self, other: P) -> Chain<Self, P>where
P: Pattern,
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
Source§fn expect_eq(self, expected_value: Self::Value) -> Expect<Self>
fn expect_eq(self, expected_value: Self::Value) -> Expect<Self>
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
Auto Trait Implementations§
impl<P, F, E> Freeze for Then<P, F, E>
impl<P, F, E> RefUnwindSafe for Then<P, F, E>
impl<P, F, E> Send for Then<P, F, E>
impl<P, F, E> Sync for Then<P, F, E>
impl<P, F, E> Unpin for Then<P, F, E>
impl<P, F, E> UnwindSafe for Then<P, F, E>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<R, T> ReadFrom<R> for T
impl<R, T> ReadFrom<R> for T
Source§fn read_from(self, reader: R) -> ReadPattern<Self, R>
fn read_from(self, reader: R) -> ReadPattern<Self, R>
Creates a future instance to read a value of the pattern from
reader. Read moreSource§fn sync_read_from(self, reader: R) -> Result<Self::Value>
fn sync_read_from(self, reader: R) -> Result<Self::Value>
Synchronous version of the
ReadFrom::read_from method.Source§fn into_stream(self, reader: R) -> ReadStream<R, Self>where
Self: Clone,
fn into_stream(self, reader: R) -> ReadStream<R, Self>where
Self: Clone,
Consumes this pattern and the
reader,
returning a stream which will produce a sequence of read values. Read moreSource§impl<W, T> WriteInto<W> for T
impl<W, T> WriteInto<W> for T
Source§fn write_into(self, writer: W) -> WritePattern<Self, W>
fn write_into(self, writer: W) -> WritePattern<Self, W>
Creates a future instance to write a value of the pattern to
writer. Read moreSource§fn sync_write_into(self, writer: W) -> Result<Self::Value>
fn sync_write_into(self, writer: W) -> Result<Self::Value>
Synchronous version of the
WriteInto::write_into method.