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