Enum handy_io::pattern::Branch
[−]
[src]
pub enum Branch<A, B = A, C = A, D = A, E = A, F = A, G = A, H = A> { A(A), B(B), C(C), D(D), E(E), F(F), G(G), H(H), }
A pattern which represents branches in a pattern.
All branches must have the same resulting value type.
Variants
A(A)
B(B)
C(C)
D(D)
E(E)
F(F)
G(G)
H(H)
Trait Implementations
impl<R: Read, A, B, C, D, E, F, G, H> ReadFrom<R> for Branch<A, B, C, D, E, F, G, H> where
A: ReadFrom<R>,
B: ReadFrom<R, Value = A::Value>,
C: ReadFrom<R, Value = A::Value>,
D: ReadFrom<R, Value = A::Value>,
E: ReadFrom<R, Value = A::Value>,
F: ReadFrom<R, Value = A::Value>,
G: ReadFrom<R, Value = A::Value>,
H: ReadFrom<R, Value = A::Value>,
[src]
A: ReadFrom<R>,
B: ReadFrom<R, Value = A::Value>,
C: ReadFrom<R, Value = A::Value>,
D: ReadFrom<R, Value = A::Value>,
E: ReadFrom<R, Value = A::Value>,
F: ReadFrom<R, Value = A::Value>,
G: ReadFrom<R, Value = A::Value>,
H: ReadFrom<R, Value = A::Value>,
type Future = ReadBranch<R, A, B, C, D, E, F, G, H>
The future to read a value of the pattern from R
.
fn lossless_read_from(self, reader: R) -> Self::Future
Creates a future instance to read a value of the pattern from reader
.
fn read_from(self, reader: R) -> LossyReadFrom<R, Self::Future>
Creates a future instance to read a value of the pattern from reader
. Read more
fn sync_read_from(self, reader: R) -> Result<Self::Value>
Scynchronously reading a value of the pattern from reader
. Read more
fn boxed(self) -> BoxReadFrom<R, Self::Value> where
Self: Send + 'static,
Self::Future: Send + 'static,
Self: Send + 'static,
Self::Future: Send + 'static,
Returns the boxed version of this pattern.
impl<W: Write, A, B, C, D, E, F, G, H> WriteTo<W> for Branch<A, B, C, D, E, F, G, H> where
A: WriteTo<W>,
B: WriteTo<W, Value = A::Value>,
C: WriteTo<W, Value = A::Value>,
D: WriteTo<W, Value = A::Value>,
E: WriteTo<W, Value = A::Value>,
F: WriteTo<W, Value = A::Value>,
G: WriteTo<W, Value = A::Value>,
H: WriteTo<W, Value = A::Value>,
[src]
A: WriteTo<W>,
B: WriteTo<W, Value = A::Value>,
C: WriteTo<W, Value = A::Value>,
D: WriteTo<W, Value = A::Value>,
E: WriteTo<W, Value = A::Value>,
F: WriteTo<W, Value = A::Value>,
G: WriteTo<W, Value = A::Value>,
H: WriteTo<W, Value = A::Value>,
type Future = WriteBranch<W, A, B, C, D, E, F, G, H>
The future to write a value of the pattern to W
.
fn lossless_write_to(self, writer: W) -> Self::Future
Creates a future instance to write a value of the pattern to writer
.
fn write_to(self, writer: W) -> LossyWriteTo<W, Self::Future>
Creates a future instance to write a value of the pattern to writer
. Read more
fn sync_write_to(self, writer: W) -> Result<Self::Value>
Scynchronously writing a value of the pattern to writer
. Read more
fn boxed(self) -> BoxWriteTo<W, Self::Value> where
Self: Send + 'static,
Self::Future: Send + 'static,
Self: Send + 'static,
Self::Future: Send + 'static,
Returns the boxed version of this pattern.
impl<A, B, C, D, E, F, G, H> Pattern for Branch<A, B, C, D, E, F, G, H> where
A: Pattern,
B: Pattern<Value = A::Value>,
C: Pattern<Value = A::Value>,
D: Pattern<Value = A::Value>,
E: Pattern<Value = A::Value>,
F: Pattern<Value = A::Value>,
G: Pattern<Value = A::Value>,
H: Pattern<Value = A::Value>,
[src]
A: Pattern,
B: Pattern<Value = A::Value>,
C: Pattern<Value = A::Value>,
D: Pattern<Value = A::Value>,
E: Pattern<Value = A::Value>,
F: Pattern<Value = A::Value>,
G: Pattern<Value = A::Value>,
H: Pattern<Value = A::Value>,
type Value = A::Value
The value type associated to the pattern.
fn then<F, P>(self, f: F) -> Then<Self, F> where
F: FnOnce(Result<Self::Value>) -> P,
F: FnOnce(Result<Self::Value>) -> 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,
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>(self, f: F) -> OrElse<Self, F> where
F: FnOnce(Error) -> P,
F: FnOnce(Error) -> 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 map<F, T>(self, f: F) -> Map<Self, F> where
F: FnOnce(Self::Value) -> T,
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,
P: Pattern,
Takes two patterns and creates a new pattern over both in sequence. Read more
fn repeat(self) -> Repeat<Self> where
Self: Clone,
Self: Clone,
Creates Repeat
pattern to represent an infinite stream of this pattern.
impl<A, B, C, D, E, F, G, H> Future for Branch<A, B, C, D, E, F, G, H> where
A: Future,
B: Future<Item = A::Item, Error = A::Error>,
C: Future<Item = A::Item, Error = A::Error>,
D: Future<Item = A::Item, Error = A::Error>,
E: Future<Item = A::Item, Error = A::Error>,
F: Future<Item = A::Item, Error = A::Error>,
G: Future<Item = A::Item, Error = A::Error>,
H: Future<Item = A::Item, Error = A::Error>,
[src]
A: Future,
B: Future<Item = A::Item, Error = A::Error>,
C: Future<Item = A::Item, Error = A::Error>,
D: Future<Item = A::Item, Error = A::Error>,
E: Future<Item = A::Item, Error = A::Error>,
F: Future<Item = A::Item, Error = A::Error>,
G: Future<Item = A::Item, Error = A::Error>,
H: Future<Item = A::Item, Error = A::Error>,
type Item = A::Item
The type of value that this future will resolved with if it is successful. Read more
type Error = A::Error
The type of error that this future will resolve with if it fails in a normal fashion. Read more
fn poll(&mut self) -> Poll<Self::Item, Self::Error>
Query this future to see if its value has become available, registering interest if it is not. Read more
fn wait(self) -> Result<Self::Item, Self::Error>
Block the current thread until this future is resolved. Read more
fn boxed(
self
) -> Box<Future<Error = Self::Error, Item = Self::Item> + 'static + Send> where
Self: Send + 'static,
self
) -> Box<Future<Error = Self::Error, Item = Self::Item> + 'static + Send> where
Self: Send + 'static,
Convenience function for turning this future into a trait object which is also Send
. Read more
fn map<F, U>(self, f: F) -> Map<Self, F> where
F: FnOnce(Self::Item) -> U,
F: FnOnce(Self::Item) -> U,
Map this future's result to a different type, returning a new future of the resulting type. Read more
fn map_err<F, E>(self, f: F) -> MapErr<Self, F> where
F: FnOnce(Self::Error) -> E,
F: FnOnce(Self::Error) -> E,
Map this future's error to a different error, returning a new future. Read more
fn from_err<E>(self) -> FromErr<Self, E> where
E: From<Self::Error>,
E: From<Self::Error>,
Map this future's error to any error implementing From
for this future's Error
, returning a new future. Read more
fn then<F, B>(self, f: F) -> Then<Self, B, F> where
B: IntoFuture,
F: FnOnce(Result<Self::Item, Self::Error>) -> B,
B: IntoFuture,
F: FnOnce(Result<Self::Item, Self::Error>) -> B,
Chain on a computation for when a future finished, passing the result of the future to the provided closure f
. Read more
fn and_then<F, B>(self, f: F) -> AndThen<Self, B, F> where
B: IntoFuture<Error = Self::Error>,
F: FnOnce(Self::Item) -> B,
B: IntoFuture<Error = Self::Error>,
F: FnOnce(Self::Item) -> B,
Execute another future after this one has resolved successfully. Read more
fn or_else<F, B>(self, f: F) -> OrElse<Self, B, F> where
B: IntoFuture<Item = Self::Item>,
F: FnOnce(Self::Error) -> B,
B: IntoFuture<Item = Self::Item>,
F: FnOnce(Self::Error) -> B,
Execute another future if this one resolves with an error. Read more
fn select<B>(self, other: B) -> Select<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Item = Self::Item, Error = Self::Error>,
B: IntoFuture<Item = Self::Item, Error = Self::Error>,
Waits for either one of two futures to complete. Read more
fn select2<B>(self, other: B) -> Select2<Self, <B as IntoFuture>::Future> where
B: IntoFuture,
B: IntoFuture,
Waits for either one of two differently-typed futures to complete. Read more
fn join<B>(self, other: B) -> Join<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
B: IntoFuture<Error = Self::Error>,
Joins the result of two futures, waiting for them both to complete. Read more
fn join3<B, C>(
self,
b: B,
c: C
) -> Join3<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
self,
b: B,
c: C
) -> Join3<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
Same as join
, but with more futures.
fn join4<B, C, D>(
self,
b: B,
c: C,
d: D
) -> Join4<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
self,
b: B,
c: C,
d: D
) -> Join4<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
Same as join
, but with more futures.
fn join5<B, C, D, E>(
self,
b: B,
c: C,
d: D,
e: E
) -> Join5<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future, <E as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
E: IntoFuture<Error = Self::Error>,
self,
b: B,
c: C,
d: D,
e: E
) -> Join5<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future, <E as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
C: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
E: IntoFuture<Error = Self::Error>,
Same as join
, but with more futures.
fn into_stream(self) -> IntoStream<Self>
Convert this future into a single element stream. Read more
fn flatten(self) -> Flatten<Self> where
Self::Item: IntoFuture,
<Self::Item as IntoFuture>::Error: From<Self::Error>,
Self::Item: IntoFuture,
<Self::Item as IntoFuture>::Error: From<Self::Error>,
Flatten the execution of this future when the successful result of this future is itself another future. Read more
fn flatten_stream(self) -> FlattenStream<Self> where
Self::Item: Stream,
<Self::Item as Stream>::Error == Self::Error,
Self::Item: Stream,
<Self::Item as Stream>::Error == Self::Error,
Flatten the execution of this future when the successful result of this future is a stream. Read more
fn fuse(self) -> Fuse<Self>
Fuse a future such that poll
will never again be called once it has completed. Read more
fn catch_unwind(self) -> CatchUnwind<Self> where
Self: UnwindSafe,
Self: UnwindSafe,
Catches unwinding panics while polling the future. Read more
Create a cloneable handle to this future where all handles will resolve to the same result. Read more