tower_ready_cache/
error.rs

1//! Errors
2
3/// A generic error type.
4pub type Error = Box<dyn std::error::Error + Send + Sync>;
5
6/// An error indicating that the service with a `K`-typed key failed with an
7/// error.
8pub struct Failed<K>(pub K, pub Error);
9
10// === Failed ===
11
12impl<K> std::fmt::Debug for Failed<K> {
13    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
14        std::fmt::Debug::fmt(&self.1, f)
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::error::Error for Failed<K> {
25    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
26        self.1.source()
27    }
28}