Skip to content

Commit 945a829

Browse files
authored
Merge pull request #45 from taiki-e/pin-utils
Remove dependency on pin-utils
2 parents 98e7689 + 74edfb9 commit 945a829

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Timeouts and intervals for futures.
1414

1515
[dependencies]
1616
futures-core = "0.3.1"
17-
pin-utils = "0.1.0-alpha.4"
1817

1918
[dev-dependencies]
2019
async-std = { version = "1.0.1", features = ["attributes"] }

src/global.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
use std::future::Future;
22
use std::io;
33
use std::mem::{self, ManuallyDrop};
4+
use std::pin::Pin;
45
use std::sync::atomic::{AtomicBool, Ordering};
56
use std::sync::Arc;
67
use std::task::{Context, RawWaker, RawWakerVTable, Waker};
78
use std::thread;
89
use std::thread::Thread;
910
use std::time::Instant;
1011

11-
use pin_utils::pin_mut;
12-
1312
use crate::{Timer, TimerHandle};
1413

1514
pub struct HelperThread {
@@ -56,13 +55,12 @@ impl Drop for HelperThread {
5655
}
5756
}
5857

59-
fn run(timer: Timer, done: Arc<AtomicBool>) {
58+
fn run(mut timer: Timer, done: Arc<AtomicBool>) {
6059
let waker = current_thread_waker();
6160
let mut cx = Context::from_waker(&waker);
6261

63-
pin_mut!(timer);
6462
while !done.load(Ordering::SeqCst) {
65-
let _ = timer.as_mut().poll(&mut cx);
63+
let _ = Pin::new(&mut timer).poll(&mut cx);
6664

6765
timer.advance();
6866
match timer.next_event() {

0 commit comments

Comments
 (0)