Coverage Report

Created: 2025-02-25 06:39

/rust/registry/src/index.crates.io-6f17d22bba15001f/hyper-util-0.1.10/src/common/timer.rs
Line
Count
Source (jump to first uncovered line)
1
#![allow(dead_code)]
2
3
use std::fmt;
4
use std::pin::Pin;
5
use std::sync::Arc;
6
use std::time::Duration;
7
use std::time::Instant;
8
9
use hyper::rt::Sleep;
10
11
#[derive(Clone)]
12
pub(crate) struct Timer(Arc<dyn hyper::rt::Timer + Send + Sync>);
13
14
// =====impl Timer=====
15
impl Timer {
16
0
    pub(crate) fn new<T>(inner: T) -> Self
17
0
    where
18
0
        T: hyper::rt::Timer + Send + Sync + 'static,
19
0
    {
20
0
        Self(Arc::new(inner))
21
0
    }
Unexecuted instantiation: <hyper_util::common::timer::Timer>::new::<hyper_util::common::timer::Timer>
Unexecuted instantiation: <hyper_util::common::timer::Timer>::new::<_>
22
}
23
24
impl fmt::Debug for Timer {
25
0
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26
0
        f.debug_struct("Timer").finish()
27
0
    }
28
}
29
30
impl hyper::rt::Timer for Timer {
31
0
    fn sleep(&self, duration: Duration) -> Pin<Box<dyn Sleep>> {
32
0
        self.0.sleep(duration)
33
0
    }
34
35
0
    fn sleep_until(&self, deadline: Instant) -> Pin<Box<dyn Sleep>> {
36
0
        self.0.sleep_until(deadline)
37
0
    }
38
}