tower/ready_cache/
error.rs

1//! Errors
2
3/// An error indicating that the service with a `K`-typed key failed with an
4/// error.
5pub struct Failed<K>(pub K, pub crate::BoxError);
6
7// === Failed ===
8
9impl<K: std::fmt::Debug> std::fmt::Debug for Failed<K> {
10    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
18impl<K> std::fmt::Display for Failed<K> {
19    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
20        self.1.fmt(f)
21    }
22}
23
24impl<K: std::fmt::Debug> std::error::Error for Failed<K> {
25    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
26        Some(&*self.1)
27    }
28}