use std::{error, fmt, time::Duration};
#[derive(Debug, Clone, Default)]
pub struct Elapsed(Duration);
impl Elapsed {
pub(crate) const fn new(duration: Duration) -> Self {
Self(duration)
}
}
impl fmt::Display for Elapsed {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "timeout elapsed after {:?}", self.0)
}
}
impl error::Error for Elapsed {}