[−][src]Trait futures::Future
A future represents an asychronous computation that may fail.
A future is like a Result
value that may not have finished computing
yet. This kind of "asynchronous value" makes it possible for a thread to
continue doing useful work while it waits for the value to become available.
The ergonomics and implementation of the Future
trait are very similar to
the Iterator
trait in that there is just one method you need to
implement, but you get a whole lot of others for free as a result. These
other methods allow you to chain together large computations based on
futures, which will automatically handle asynchrony for you.
The poll
method
The core method of future, poll
, attempts to resolve the future into a
final value. This method does not block if the value is not ready. Instead,
the current task is scheduled to be woken up when it's possible to make
further progress by poll
ing again. The wake up is performed using
cx.waker()
, a handle for waking up the current task.
When using a future, you generally won't call poll
directly, but instead
use combinators to build up asynchronous computations. A complete
computation can then be spawned onto an
executor as a new, independent
task that will automatically be poll
ed to completion.
Combinators
Like iterators, futures provide a large number of combinators to work with futures to express computations in a much more natural method than scheduling a number of callbacks. As with iterators, the combinators are zero-cost: they compile away. You can find the combinators in the future-util crate.
Associated Types
Required Methods
fn poll(&mut self, cx: &mut Context) -> Result<Async<Self::Item>, Self::Error>
Attempt to resolve the future to a final value, registering the current task for wakeup if the value is not yet available.
Return value
This function returns:
Ok(Async::Pending)
if the future is not ready yetOk(Async::Ready(val))
with the resultval
of this future if it finished successfully.Err(err)
if the future is finished but resolved to an errorerr
.
Once a future has finished, clients should not poll
it again.
When a future is not ready yet, poll
returns
Async::Pending
. The future will also register the
interest of the current task in the value being produced. For example,
if the future represents the availability of data on a socket, then the
task is recorded so that when data arrives, it is woken up (via
cx.waker()
. Once a task has been woken up,
it should attempt to poll
the future again, which may or may not
produce a final value.
Note that if Pending
is returned it only means that the current task
(represented by the argument cx
) will receive a notification. Tasks
from previous calls to poll
will not receive notifications.
Runtime characteristics
Futures alone are inert; they must be actively poll
ed to make
progress, meaning that each time the current task is woken up, it should
actively re-poll
pending futures that it still has an interest in.
Usually this is done by building up a large computation as a single
future (using combinators), then spawning that future as a task onto
an executor. Executors
ensure that each task is poll
ed every time a future internal to that
task is ready to make progress.
The poll
function is not called repeatedly in a tight loop for
futures, but only whenever the future itself is ready, as signaled via
cx.waker()
. If you're familiar with the
poll(2)
or select(2)
syscalls on Unix it's worth noting that futures
typically do not suffer the same problems of "all wakeups must poll
all events"; they are more like epoll(4)
.
An implementation of poll
should strive to return quickly, and must
never block. Returning quickly prevents unnecessarily clogging up
threads or event loops. If it is known ahead of time that a call to
poll
may end up taking awhile, the work should be offloaded to a
thread pool (or something similar) to ensure that poll
can return
quickly.
Errors
This future may have failed to finish the computation, in which case
the Err
variant will be returned with an appropriate payload of an
error.
Panics
Once a future has completed (returned Ready
or Err
from poll
),
then any future calls to poll
may panic, block forever, or otherwise
cause bad behavior. The Future
trait itself provides no guarantees
about the behavior of poll
after a future has completed.
Callers who may call poll
too many times may want to consider using
the fuse
adaptor which defines the behavior of poll
, but comes with
a little bit of extra cost.
Implementations on Foreign Types
impl<F> Future for Box<F> where
F: Future + ?Sized,
[src]
impl<F> Future for Box<F> where
F: Future + ?Sized,
type Item = <F as Future>::Item
type Error = <F as Future>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Box<F> as Future>::Item>, <Box<F> as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Box<F> as Future>::Item>, <Box<F> as Future>::Error>
impl<F> Future for AssertUnwindSafe<F> where
F: Future,
[src]
impl<F> Future for AssertUnwindSafe<F> where
F: Future,
type Item = <F as Future>::Item
type Error = <F as Future>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<F as Future>::Item>, <F as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<F as Future>::Item>, <F as Future>::Error>
impl<'a, F> Future for &'a mut F where
F: Future + ?Sized,
[src]
impl<'a, F> Future for &'a mut F where
F: Future + ?Sized,
type Item = <F as Future>::Item
type Error = <F as Future>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<&'a mut F as Future>::Item>, <&'a mut F as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<&'a mut F as Future>::Item>, <&'a mut F as Future>::Error>
impl<S, U, F> Future for ForEachConcurrent<S, U, F> where
F: FnMut(<S as Stream>::Item) -> U,
S: Stream,
U: IntoFuture<Item = (), Error = <S as Stream>::Error>,
[src]
impl<S, U, F> Future for ForEachConcurrent<S, U, F> where
F: FnMut(<S as Stream>::Item) -> U,
S: Stream,
U: IntoFuture<Item = (), Error = <S as Stream>::Error>,
type Item = S
type Error = <S as Stream>::Error
fn poll(&mut self, cx: &mut Context) -> Result<Async<S>, <S as Stream>::Error>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<S>, <S as Stream>::Error>
impl<F, E> Future for WithExecutor<F, E> where
E: Executor,
F: Future,
[src]
impl<F, E> Future for WithExecutor<F, E> where
E: Executor,
F: Future,
type Item = <F as Future>::Item
type Error = <F as Future>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<F as Future>::Item>, <F as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<F as Future>::Item>, <F as Future>::Error>
impl<A, F> Future for InspectErr<A, F> where
A: Future,
F: FnOnce(&<A as Future>::Error),
[src]
impl<A, F> Future for InspectErr<A, F> where
A: Future,
F: FnOnce(&<A as Future>::Error),
type Item = <A as Future>::Item
type Error = <A as Future>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<A as Future>::Item>, <A as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<A as Future>::Item>, <A as Future>::Error>
impl<A, E, F> Future for Recover<A, E, F> where
A: Future,
F: FnOnce(<A as Future>::Error) -> <A as Future>::Item,
[src]
impl<A, E, F> Future for Recover<A, E, F> where
A: Future,
F: FnOnce(<A as Future>::Error) -> <A as Future>::Item,
type Item = <A as Future>::Item
type Error = E
fn poll(&mut self, cx: &mut Context) -> Result<Async<<A as Future>::Item>, E>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<<A as Future>::Item>, E>
Implementors
impl Future for Never
[src]
impl Future for Never
type Item = Never
type Error = Never
fn poll(&mut self, &mut Context) -> Result<Async<Never>, Never>
[src]
fn poll(&mut self, &mut Context) -> Result<Async<Never>, Never>
impl<A> Future for Flatten<A> where
A: Future,
<A as Future>::Item: IntoFuture,
<<A as Future>::Item as IntoFuture>::Error: From<<A as Future>::Error>,
[src]
impl<A> Future for Flatten<A> where
A: Future,
<A as Future>::Item: IntoFuture,
<<A as Future>::Item as IntoFuture>::Error: From<<A as Future>::Error>,
type Item = <<A as Future>::Item as IntoFuture>::Item
type Error = <<A as Future>::Item as IntoFuture>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Flatten<A> as Future>::Item>, <Flatten<A> as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Flatten<A> as Future>::Item>, <Flatten<A> as Future>::Error>
impl<A> Future for Fuse<A> where
A: Future,
[src]
impl<A> Future for Fuse<A> where
A: Future,
type Item = <A as Future>::Item
type Error = <A as Future>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<A as Future>::Item>, <A as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<A as Future>::Item>, <A as Future>::Error>
impl<A> Future for SelectAll<A> where
A: Future,
[src]
impl<A> Future for SelectAll<A> where
A: Future,
type Item = (<A as Future>::Item, usize, Vec<A>)
type Error = (<A as Future>::Error, usize, Vec<A>)
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<SelectAll<A> as Future>::Item>, <SelectAll<A> as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<SelectAll<A> as Future>::Item>, <SelectAll<A> as Future>::Error>
impl<A> Future for SelectOk<A> where
A: Future,
[src]
impl<A> Future for SelectOk<A> where
A: Future,
type Item = (<A as Future>::Item, Vec<A>)
type Error = <A as Future>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<SelectOk<A> as Future>::Item>, <SelectOk<A> as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<SelectOk<A> as Future>::Item>, <SelectOk<A> as Future>::Error>
impl<A> Future for futures::io::Close<A> where
A: AsyncWrite,
[src]
impl<A> Future for futures::io::Close<A> where
A: AsyncWrite,
type Item = A
type Error = Error
fn poll(&mut self, cx: &mut Context) -> Result<Async<A>, Error>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<A>, Error>
impl<A> Future for futures::io::Flush<A> where
A: AsyncWrite,
[src]
impl<A> Future for futures::io::Flush<A> where
A: AsyncWrite,
type Item = A
type Error = Error
fn poll(&mut self, cx: &mut Context) -> Result<Async<A>, Error>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<A>, Error>
impl<A> Future for ReadToEnd<A> where
A: AsyncRead,
[src]
impl<A> Future for ReadToEnd<A> where
A: AsyncRead,
type Item = (A, Vec<u8>)
type Error = Error
fn poll(&mut self, cx: &mut Context) -> Result<Async<(A, Vec<u8>)>, Error>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<(A, Vec<u8>)>, Error>
impl<A, B> Future for Either<A, B> where
A: Future,
B: Future<Item = <A as Future>::Item, Error = <A as Future>::Error>,
[src]
impl<A, B> Future for Either<A, B> where
A: Future,
B: Future<Item = <A as Future>::Item, Error = <A as Future>::Error>,
type Item = <A as Future>::Item
type Error = <A as Future>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<A as Future>::Item>, <A as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<A as Future>::Item>, <A as Future>::Error>
impl<A, B> Future for Join<A, B> where
A: Future,
B: Future<Error = <A as Future>::Error>,
[src]
impl<A, B> Future for Join<A, B> where
A: Future,
B: Future<Error = <A as Future>::Error>,
type Item = (<A as Future>::Item, <B as Future>::Item)
type Error = <A as Future>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Join<A, B> as Future>::Item>, <Join<A, B> as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Join<A, B> as Future>::Item>, <Join<A, B> as Future>::Error>
impl<A, B> Future for Select<A, B> where
A: Future,
B: Future,
[src]
impl<A, B> Future for Select<A, B> where
A: Future,
B: Future,
type Item = Either<(<A as Future>::Item, B), (<B as Future>::Item, A)>
type Error = Either<(<A as Future>::Error, B), (<B as Future>::Error, A)>
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Select<A, B> as Future>::Item>, <Select<A, B> as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Select<A, B> as Future>::Item>, <Select<A, B> as Future>::Error>
impl<A, B, C> Future for Join3<A, B, C> where
A: Future,
B: Future<Error = <A as Future>::Error>,
C: Future<Error = <A as Future>::Error>,
[src]
impl<A, B, C> Future for Join3<A, B, C> where
A: Future,
B: Future<Error = <A as Future>::Error>,
C: Future<Error = <A as Future>::Error>,
type Item = (<A as Future>::Item, <B as Future>::Item, <C as Future>::Item)
type Error = <A as Future>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Join3<A, B, C> as Future>::Item>, <Join3<A, B, C> as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Join3<A, B, C> as Future>::Item>, <Join3<A, B, C> as Future>::Error>
impl<A, B, C, D> Future for Join4<A, B, C, D> where
A: Future,
B: Future<Error = <A as Future>::Error>,
C: Future<Error = <A as Future>::Error>,
D: Future<Error = <A as Future>::Error>,
[src]
impl<A, B, C, D> Future for Join4<A, B, C, D> where
A: Future,
B: Future<Error = <A as Future>::Error>,
C: Future<Error = <A as Future>::Error>,
D: Future<Error = <A as Future>::Error>,
type Item = (<A as Future>::Item, <B as Future>::Item, <C as Future>::Item, <D as Future>::Item)
type Error = <A as Future>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Join4<A, B, C, D> as Future>::Item>, <Join4<A, B, C, D> as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Join4<A, B, C, D> as Future>::Item>, <Join4<A, B, C, D> as Future>::Error>
impl<A, B, C, D, E> Future for Join5<A, B, C, D, E> where
A: Future,
B: Future<Error = <A as Future>::Error>,
C: Future<Error = <A as Future>::Error>,
D: Future<Error = <A as Future>::Error>,
E: Future<Error = <A as Future>::Error>,
[src]
impl<A, B, C, D, E> Future for Join5<A, B, C, D, E> where
A: Future,
B: Future<Error = <A as Future>::Error>,
C: Future<Error = <A as Future>::Error>,
D: Future<Error = <A as Future>::Error>,
E: Future<Error = <A as Future>::Error>,
type Item = (<A as Future>::Item, <B as Future>::Item, <C as Future>::Item, <D as Future>::Item, <E as Future>::Item)
type Error = <A as Future>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Join5<A, B, C, D, E> as Future>::Item>, <Join5<A, B, C, D, E> as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Join5<A, B, C, D, E> as Future>::Item>, <Join5<A, B, C, D, E> as Future>::Error>
impl<A, B, F> Future for AndThen<A, B, F> where
A: Future,
B: IntoFuture<Error = <A as Future>::Error>,
F: FnOnce(<A as Future>::Item) -> B,
[src]
impl<A, B, F> Future for AndThen<A, B, F> where
A: Future,
B: IntoFuture<Error = <A as Future>::Error>,
F: FnOnce(<A as Future>::Item) -> B,
type Item = <B as IntoFuture>::Item
type Error = <B as IntoFuture>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<B as IntoFuture>::Item>, <B as IntoFuture>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<B as IntoFuture>::Item>, <B as IntoFuture>::Error>
impl<A, B, F> Future for OrElse<A, B, F> where
A: Future,
B: IntoFuture<Item = <A as Future>::Item>,
F: FnOnce(<A as Future>::Error) -> B,
[src]
impl<A, B, F> Future for OrElse<A, B, F> where
A: Future,
B: IntoFuture<Item = <A as Future>::Item>,
F: FnOnce(<A as Future>::Error) -> B,
type Item = <B as IntoFuture>::Item
type Error = <B as IntoFuture>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<B as IntoFuture>::Item>, <B as IntoFuture>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<B as IntoFuture>::Item>, <B as IntoFuture>::Error>
impl<A, B, F> Future for Then<A, B, F> where
A: Future,
B: IntoFuture,
F: FnOnce(Result<<A as Future>::Item, <A as Future>::Error>) -> B,
[src]
impl<A, B, F> Future for Then<A, B, F> where
A: Future,
B: IntoFuture,
F: FnOnce(Result<<A as Future>::Item, <A as Future>::Error>) -> B,
type Item = <B as IntoFuture>::Item
type Error = <B as IntoFuture>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<B as IntoFuture>::Item>, <B as IntoFuture>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<B as IntoFuture>::Item>, <B as IntoFuture>::Error>
impl<A, E> Future for ErrInto<A, E> where
A: Future,
<A as Future>::Error: Into<E>,
[src]
impl<A, E> Future for ErrInto<A, E> where
A: Future,
<A as Future>::Error: Into<E>,
type Item = <A as Future>::Item
type Error = E
fn poll(&mut self, cx: &mut Context) -> Result<Async<<A as Future>::Item>, E>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<<A as Future>::Item>, E>
impl<A, F> Future for Inspect<A, F> where
A: Future,
F: FnOnce(&<A as Future>::Item),
[src]
impl<A, F> Future for Inspect<A, F> where
A: Future,
F: FnOnce(&<A as Future>::Item),
type Item = <A as Future>::Item
type Error = <A as Future>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<A as Future>::Item>, <A as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<A as Future>::Item>, <A as Future>::Error>
impl<A, T> Future for ReadExact<A, T> where
A: AsyncRead,
T: AsMut<[u8]>,
[src]
impl<A, T> Future for ReadExact<A, T> where
A: AsyncRead,
T: AsMut<[u8]>,
type Item = (A, T)
type Error = Error
fn poll(&mut self, cx: &mut Context) -> Result<Async<(A, T)>, Error>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<(A, T)>, Error>
impl<A, T> Future for WriteAll<A, T> where
A: AsyncWrite,
T: AsRef<[u8]>,
[src]
impl<A, T> Future for WriteAll<A, T> where
A: AsyncWrite,
T: AsRef<[u8]>,
type Item = (A, T)
type Error = Error
fn poll(&mut self, cx: &mut Context) -> Result<Async<(A, T)>, Error>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<(A, T)>, Error>
impl<F> Future for Spawn<F> where
F: Send + Future<Item = (), Error = Never> + 'static,
[src]
impl<F> Future for Spawn<F> where
F: Send + Future<Item = (), Error = Never> + 'static,
type Item = ()
type Error = Never
fn poll(&mut self, cx: &mut Context) -> Result<Async<()>, Never>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<()>, Never>
impl<F> Future for SpawnWithHandle<F> where
F: Future + Send + 'static,
<F as Future>::Item: Send,
<F as Future>::Error: Send,
[src]
impl<F> Future for SpawnWithHandle<F> where
F: Future + Send + 'static,
<F as Future>::Item: Send,
<F as Future>::Error: Send,
type Item = JoinHandle<<F as Future>::Item, <F as Future>::Error>
type Error = Never
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<SpawnWithHandle<F> as Future>::Item>, Never>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<SpawnWithHandle<F> as Future>::Item>, Never>
impl<F> Future for CatchUnwind<F> where
F: Future + UnwindSafe,
[src]
impl<F> Future for CatchUnwind<F> where
F: Future + UnwindSafe,
type Item = Result<<F as Future>::Item, <F as Future>::Error>
type Error = Box<Any + 'static + Send>
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<CatchUnwind<F> as Future>::Item>, <CatchUnwind<F> as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<CatchUnwind<F> as Future>::Item>, <CatchUnwind<F> as Future>::Error>
impl<F> Future for JoinAll<F> where
F: Future,
[src]
impl<F> Future for JoinAll<F> where
F: Future,
type Item = Vec<<F as Future>::Item>
type Error = <F as Future>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<JoinAll<F> as Future>::Item>, <JoinAll<F> as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<JoinAll<F> as Future>::Item>, <JoinAll<F> as Future>::Error>
impl<F> Future for Shared<F> where
F: Future,
[src]
impl<F> Future for Shared<F> where
F: Future,
type Item = SharedItem<<F as Future>::Item>
type Error = SharedError<<F as Future>::Error>
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Shared<F> as Future>::Item>, <Shared<F> as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Shared<F> as Future>::Item>, <Shared<F> as Future>::Error>
impl<F, T, E> Future for FutureOption<F> where
F: Future<Item = T, Error = E>,
[src]
impl<F, T, E> Future for FutureOption<F> where
F: Future<Item = T, Error = E>,
type Item = Option<T>
type Error = E
fn poll(&mut self, cx: &mut Context) -> Result<Async<Option<T>>, E>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<Option<T>>, E>
impl<R, F> Future for Lazy<R, F> where
F: FnOnce(&mut Context) -> R,
R: IntoFuture,
[src]
impl<R, F> Future for Lazy<R, F> where
F: FnOnce(&mut Context) -> R,
R: IntoFuture,
type Item = <R as IntoFuture>::Item
type Error = <R as IntoFuture>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<R as IntoFuture>::Item>, <R as IntoFuture>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<R as IntoFuture>::Item>, <R as IntoFuture>::Error>
impl<R, T> Future for Read<R, T> where
R: AsyncRead,
T: AsMut<[u8]>,
[src]
impl<R, T> Future for Read<R, T> where
R: AsyncRead,
T: AsMut<[u8]>,
type Item = (R, T, usize)
type Error = Error
fn poll(&mut self, cx: &mut Context) -> Result<Async<(R, T, usize)>, Error>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<(R, T, usize)>, Error>
impl<R, W> Future for CopyInto<R, W> where
R: AsyncRead,
W: AsyncWrite,
[src]
impl<R, W> Future for CopyInto<R, W> where
R: AsyncRead,
W: AsyncWrite,
type Item = (u64, R, W)
type Error = Error
fn poll(&mut self, cx: &mut Context) -> Result<Async<(u64, R, W)>, Error>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<(u64, R, W)>, Error>
impl<S> Future for futures::sink::Close<S> where
S: Sink,
[src]
impl<S> Future for futures::sink::Close<S> where
S: Sink,
type Item = S
type Error = <S as Sink>::SinkError
fn poll(&mut self, cx: &mut Context) -> Result<Async<S>, <S as Sink>::SinkError>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<S>, <S as Sink>::SinkError>
impl<S> Future for futures::sink::Flush<S> where
S: Sink,
[src]
impl<S> Future for futures::sink::Flush<S> where
S: Sink,
type Item = S
type Error = <S as Sink>::SinkError
fn poll(&mut self, cx: &mut Context) -> Result<Async<S>, <S as Sink>::SinkError>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<S>, <S as Sink>::SinkError>
impl<S> Future for Send<S> where
S: Sink,
[src]
impl<S> Future for Send<S> where
S: Sink,
type Item = S
type Error = <S as Sink>::SinkError
fn poll(&mut self, cx: &mut Context) -> Result<Async<S>, <S as Sink>::SinkError>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<S>, <S as Sink>::SinkError>
impl<S> Future for Concat<S> where
S: Stream,
<S as Stream>::Item: Extend<<<S as Stream>::Item as IntoIterator>::Item>,
<S as Stream>::Item: IntoIterator,
<S as Stream>::Item: Default,
[src]
impl<S> Future for Concat<S> where
S: Stream,
<S as Stream>::Item: Extend<<<S as Stream>::Item as IntoIterator>::Item>,
<S as Stream>::Item: IntoIterator,
<S as Stream>::Item: Default,
type Item = <S as Stream>::Item
type Error = <S as Stream>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Concat<S> as Future>::Item>, <Concat<S> as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<Concat<S> as Future>::Item>, <Concat<S> as Future>::Error>
impl<S> Future for StreamFuture<S> where
S: Stream,
[src]
impl<S> Future for StreamFuture<S> where
S: Stream,
type Item = (Option<<S as Stream>::Item>, S)
type Error = (<S as Stream>::Error, S)
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<StreamFuture<S> as Future>::Item>, <StreamFuture<S> as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<StreamFuture<S> as Future>::Item>, <StreamFuture<S> as Future>::Error>
impl<S, C> Future for Collect<S, C> where
C: Default + Extend<<S as Stream>::Item>,
S: Stream,
[src]
impl<S, C> Future for Collect<S, C> where
C: Default + Extend<<S as Stream>::Item>,
S: Stream,
type Item = C
type Error = <S as Stream>::Error
fn poll(&mut self, cx: &mut Context) -> Result<Async<C>, <S as Stream>::Error>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<C>, <S as Stream>::Error>
impl<S, Fut, T, F> Future for Fold<S, Fut, T, F> where
F: FnMut(T, <S as Stream>::Item) -> Fut,
Fut: IntoFuture<Item = T, Error = <S as Stream>::Error>,
S: Stream,
[src]
impl<S, Fut, T, F> Future for Fold<S, Fut, T, F> where
F: FnMut(T, <S as Stream>::Item) -> Fut,
Fut: IntoFuture<Item = T, Error = <S as Stream>::Error>,
S: Stream,
type Item = T
type Error = <S as Stream>::Error
fn poll(&mut self, cx: &mut Context) -> Result<Async<T>, <S as Stream>::Error>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<T>, <S as Stream>::Error>
impl<S, T, A, F> Future for LoopFn<A, F> where
A: IntoFuture<Item = Loop<T, S>>,
F: FnMut(S) -> A,
[src]
impl<S, T, A, F> Future for LoopFn<A, F> where
A: IntoFuture<Item = Loop<T, S>>,
F: FnMut(S) -> A,
type Item = T
type Error = <A as IntoFuture>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<LoopFn<A, F> as Future>::Item>, <LoopFn<A, F> as Future>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<<LoopFn<A, F> as Future>::Item>, <LoopFn<A, F> as Future>::Error>
impl<S, U, F> Future for ForEach<S, U, F> where
F: FnMut(<S as Stream>::Item) -> U,
S: Stream,
U: IntoFuture<Item = (), Error = <S as Stream>::Error>,
[src]
impl<S, U, F> Future for ForEach<S, U, F> where
F: FnMut(<S as Stream>::Item) -> U,
S: Stream,
U: IntoFuture<Item = (), Error = <S as Stream>::Error>,
type Item = S
type Error = <S as Stream>::Error
fn poll(&mut self, cx: &mut Context) -> Result<Async<S>, <S as Stream>::Error>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<S>, <S as Stream>::Error>
impl<T> Future for Receiver<T>
[src]
impl<T> Future for Receiver<T>
type Item = T
type Error = Canceled
fn poll(&mut self, cx: &mut Context) -> Result<Async<T>, Canceled>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<T>, Canceled>
impl<T, E> Future for JoinHandle<T, E> where
E: 'static + Send,
T: 'static + Send,
[src]
impl<T, E> Future for JoinHandle<T, E> where
E: 'static + Send,
T: 'static + Send,
impl<T, E> Future for Empty<T, E>
[src]
impl<T, E> Future for Empty<T, E>
impl<T, E> Future for FutureResult<T, E>
[src]
impl<T, E> Future for FutureResult<T, E>
impl<T, E, F> Future for PollFn<F> where
F: FnMut(&mut Context) -> Result<Async<T>, E>,
[src]
impl<T, E, F> Future for PollFn<F> where
F: FnMut(&mut Context) -> Result<Async<T>, E>,
impl<T, U> Future for SendAll<T, U> where
T: Sink,
U: Stream<Item = <T as Sink>::SinkItem>,
<T as Sink>::SinkError: From<<U as Stream>::Error>,
[src]
impl<T, U> Future for SendAll<T, U> where
T: Sink,
U: Stream<Item = <T as Sink>::SinkItem>,
<T as Sink>::SinkError: From<<U as Stream>::Error>,
type Item = (T, U)
type Error = <T as Sink>::SinkError
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<(T, U)>, <T as Sink>::SinkError>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<(T, U)>, <T as Sink>::SinkError>
impl<T, U> Future for Forward<T, U> where
T: Stream,
U: Sink<SinkItem = <T as Stream>::Item>,
<T as Stream>::Error: From<<U as Sink>::SinkError>,
[src]
impl<T, U> Future for Forward<T, U> where
T: Stream,
U: Sink<SinkItem = <T as Stream>::Item>,
<T as Stream>::Error: From<<U as Sink>::SinkError>,
type Item = (T, U)
type Error = <T as Stream>::Error
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<(T, U)>, <T as Stream>::Error>
[src]
fn poll(
&mut self,
cx: &mut Context
) -> Result<Async<(T, U)>, <T as Stream>::Error>
impl<U, A, F> Future for Map<A, F> where
A: Future,
F: FnOnce(<A as Future>::Item) -> U,
[src]
impl<U, A, F> Future for Map<A, F> where
A: Future,
F: FnOnce(<A as Future>::Item) -> U,
type Item = U
type Error = <A as Future>::Error
fn poll(&mut self, cx: &mut Context) -> Result<Async<U>, <A as Future>::Error>
[src]
fn poll(&mut self, cx: &mut Context) -> Result<Async<U>, <A as Future>::Error>
impl<U, A, F> Future for MapErr<A, F> where
A: Future,
F: FnOnce(<A as Future>::Error) -> U,
[src]
impl<U, A, F> Future for MapErr<A, F> where
A: Future,
F: FnOnce(<A as Future>::Error) -> U,