diff --git a/zed/src/lib.rs b/zed/src/lib.rs index 16307bc19a..9bf663d076 100644 --- a/zed/src/lib.rs +++ b/zed/src/lib.rs @@ -9,7 +9,6 @@ mod sum_tree; mod test; mod throttle; mod time; -mod timer; mod util; pub mod watch; pub mod workspace; diff --git a/zed/src/timer.rs b/zed/src/timer.rs deleted file mode 100644 index de3f9e17b0..0000000000 --- a/zed/src/timer.rs +++ /dev/null @@ -1,42 +0,0 @@ -use smol::prelude::*; -use std::{ - pin::Pin, - task::Poll, - time::{Duration, Instant}, -}; - -pub struct Repeat { - timer: smol::Timer, - period: Duration, -} - -impl Stream for Repeat { - type Item = Instant; - - fn poll_next( - mut self: std::pin::Pin<&mut Self>, - cx: &mut std::task::Context<'_>, - ) -> Poll> { - match self.as_mut().timer().poll(cx) { - Poll::Ready(instant) => { - let period = self.as_ref().period; - self.as_mut().timer().set_after(period); - Poll::Ready(Some(instant)) - } - Poll::Pending => Poll::Pending, - } - } -} - -impl Repeat { - fn timer(self: std::pin::Pin<&mut Self>) -> Pin<&mut smol::Timer> { - unsafe { self.map_unchecked_mut(|s| &mut s.timer) } - } -} - -pub fn repeat(period: Duration) -> Repeat { - Repeat { - timer: smol::Timer::after(period), - period, - } -}