1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::time::{Duration, Instant};
/// the time when request enter service
#[derive(Debug, Clone, Copy)]
pub struct EnterTime(pub Instant);
impl EnterTime {
    pub fn new() -> Self {
        Self(Instant::now())
    }
    pub fn elapsed(&self) -> Duration {
        self.0.elapsed()
    }
}

impl Default for EnterTime {
    fn default() -> Self {
        Self::new()
    }
}