tower_timeout/error.rs
1//! Error types
2
3use std::{error, fmt};
4
5pub(crate) type Error = Box<dyn error::Error + Send + Sync>;
6
7/// The timeout elapsed.
8#[derive(Debug)]
9pub struct Elapsed(pub(super) ());
10
11impl Elapsed {
12 /// Construct a new elapsed error
13 pub fn new() -> Self {
14 Elapsed(())
15 }
16}
17
18impl fmt::Display for Elapsed {
19 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20 f.pad("request timed out")
21 }
22}
23
24impl error::Error for Elapsed {}