firestore_structured_query/
error.rs1pub type Result<T> = std::result::Result<T, Error>;
3
4#[derive(Debug)]
6pub struct Error {
7 source: Box<dyn std::error::Error + Send + Sync>,
8}
9
10impl Error {
11 pub fn new<E>(source: E) -> Self
13 where
14 E: Into<Box<dyn std::error::Error + Send + Sync>>,
15 {
16 Self::from(source.into())
17 }
18}
19
20impl std::convert::From<Box<dyn std::error::Error + Send + Sync>> for Error {
21 fn from(source: Box<dyn std::error::Error + Send + Sync>) -> Self {
22 Self { source }
23 }
24}
25
26impl std::error::Error for Error {
27 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
28 Some(&*self.source)
29 }
30}
31
32impl std::fmt::Display for Error {
33 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
34 self.source.fmt(f)
35 }
36}