Skip to content

Commit 2250577

Browse files
committed
Fix pinning
1 parent ae4a837 commit 2250577

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/delay_wasm.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
use gloo_timers::future::TimeoutFuture;
44
use std::{time::Duration, pin::Pin, task::{Context, Poll}, future::Future};
55

6+
/// A version of `Delay` that works on wasm.
67
#[derive(Debug)]
78
pub struct Delay(TimeoutFuture);
89

910
impl Delay {
11+
/// Creates a new future which will fire at `dur` time into the future.
1012
#[inline]
1113
pub fn new(dur: Duration) -> Delay {
1214
Self(TimeoutFuture::new(dur.as_millis() as u32))
@@ -17,6 +19,6 @@ impl Future for Delay {
1719
type Output = ();
1820

1921
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
20-
Pin::new(*self.0).poll(cx)
22+
Pin::new(&mut Pin::into_inner(self).0).poll(cx)
2123
}
2224
}

0 commit comments

Comments
 (0)