1 //! Errors 2 3 /// An error indicating that the service with a `K`-typed key failed with an 4 /// error. 5 pub struct Failed<K>(pub K, pub crate::BoxError); 6 7 // === Failed === 8 9 impl<K: std::fmt::Debug> std::fmt::Debug for Failed<K> { fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result10 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 11 f.debug_tuple("Failed") 12 .field(&self.0) 13 .field(&self.1) 14 .finish() 15 } 16 } 17 18 impl<K> std::fmt::Display for Failed<K> { fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result19 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 20 self.1.fmt(f) 21 } 22 } 23 24 impl<K: std::fmt::Debug> std::error::Error for Failed<K> { source(&self) -> Option<&(dyn std::error::Error + 'static)>25 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { 26 Some(&*self.1) 27 } 28 } 29