mirror of https://github.com/rust-lang/async-book
Fix pinning example
The existing `AsyncFuture` example wouldn't compile due to missing the Future trait's required `Output` type and not marking `self` as mutable (required to update `AsyncFuture::state`).
This commit is contained in:
parent
a276e7ebdc
commit
799fded3c8
|
@ -40,7 +40,9 @@ enum State {
|
|||
}
|
||||
|
||||
impl Future for AsyncFuture {
|
||||
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
|
||||
type Output = ();
|
||||
|
||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
|
||||
loop {
|
||||
match self.state {
|
||||
State::AwaitingFutOne => match self.fut_one.poll(..) {
|
||||
|
|
Loading…
Reference in New Issue