mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-03 08:54:04 +00:00
Remove unused timer module
This commit is contained in:
parent
3fa4e5acee
commit
0caf908c78
2 changed files with 0 additions and 43 deletions
|
@ -9,7 +9,6 @@ mod sum_tree;
|
|||
mod test;
|
||||
mod throttle;
|
||||
mod time;
|
||||
mod timer;
|
||||
mod util;
|
||||
pub mod watch;
|
||||
pub mod workspace;
|
||||
|
|
|
@ -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<Option<Self::Item>> {
|
||||
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,
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue