Expand description
Asynchronous values.
This module contains:
-
The
Future
trait. -
The
FutureExt
trait, which provides adapters for chaining and composing futures. -
Top-level future combinators like
lazy
which creates a future from a closure that defines its return value, andresult
, which constructs a future with an immediate defined value.
Structs§
- AndThen
- Future for the
and_then
combinator, chaining a computation onto the end of another future which completes successfully. - Catch
Unwind - Future for the
catch_unwind
combinator. - Empty
- A future which is never resolved.
- ErrInto
- Future for the
err_into
combinator, changing the error type of a future. - Flatten
- Future for the
flatten
combinator. - Flatten
Stream - Future for the
flatten_stream
combinator, flattening a future-of-a-stream to get just the result of the final stream as a stream. - Fuse
- A future which “fuses” a future once it’s been resolved.
- Future
Option - A future representing a value which may or may not be present.
- Future
Result - A future representing a value that is immediately ready.
- Inspect
- Do something with the item of a future, passing it on.
- Into
Stream - A type which converts a
Future
into aStream
containing a single element. - Join
- Future for the
join
combinator, waiting for two futures to complete. - Join3
- Future for the
join3
combinator, waiting for three futures to complete. - Join4
- Future for the
join4
combinator, waiting for four futures to complete. - Join5
- Future for the
join5
combinator, waiting for five futures to complete. - JoinAll
- A future which takes a list of futures and resolves with a vector of the completed values.
- Lazy
- A future which defers creation of the actual future until the future
is
poll
ed. - LoopFn
- A future implementing a tail-recursive loop.
- Map
- Future for the
map
combinator, changing the type of a future. - MapErr
- Future for the
map_err
combinator, changing the error type of a future. - OrElse
- Future for the
or_else
combinator, chaining a computation onto the end of a future which fails with an error. - PollFn
- A future which adapts a function returning
Poll
. - Select
- Future for the
select
combinator, waiting for one of two differently-typed futures to complete. - Select
All - Future for the
select_all
combinator, waiting for one of any of a list of futures to complete. - Select
Ok - Future for the
select_ok
combinator, waiting for one of any of a list of futures to successfully complete. Unlikeselect_all
, this future ignores all but the last error, if there are any. - Shared
- A future that is cloneable and can be polled in multiple threads.
Use
Future::shared()
method to convert any future into aShared
future. - Shared
Error - A wrapped error of the original future that is cloneable and implements Deref for ease of use.
- Shared
Item - A wrapped item of the original future that is cloneable and implements Deref for ease of use.
- Then
- Future for the
then
combinator, chaining computations on the end of another future regardless of its outcome.
Enums§
- Either
- The enum
Either
with variantsLeft
andRight
is a general purpose sum type with two cases. - Loop
- An enum describing whether to
break
orcontinue
aloop_fn
loop.
Traits§
- Future
- A future represents an asychronous computation that may fail.
- Future
Ext - An extension trait for
Future
s that provides a variety of convenient combinator functions. - Into
Future - Types that can be converted into a future.
Functions§
- empty
- Creates a future which never resolves, representing a computation that never finishes.
- err
- Creates a new future that will immediately fail with the given error.
- join_
all - Creates a future which represents a collection of the results of the futures given.
- lazy
- Creates a new future which will eventually be the same as the one created by the closure provided.
- loop_fn
- Creates a new future implementing a tail-recursive loop.
- ok
- Creates a new future that will immediately resolve successfully to the given value.
- poll_fn
- Creates a new future wrapping around a function returning
Poll
. - result
- Creates a new future that will immediate resolve with the given result.
- select_
all - Creates a new future which will select over a list of futures.
- select_
ok - Creates a new future which will select the first successful future over a list of futures.