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