1use derive_more::{Display, From};
2use uuid::Uuid;
3
4pub type Result<T> = core::result::Result<T, Error>;
5
6#[derive(Debug, Display, From)]
7#[display("{self:?}")]
8pub enum Error {
9 #[from(String, &String, &str)]
10 Custom(String),
11
12 FailToDecode16U8 {
13 context: &'static str,
14 actual_length: usize,
15 },
16
17 FailExtractTimeNoUuidV7(Uuid),
18
19 #[from]
21 Io(std::io::Error), }
23
24impl Error {
27 pub fn custom_from_err(err: impl std::error::Error) -> Self {
28 Self::Custom(err.to_string())
29 }
30
31 pub fn custom(val: impl Into<String>) -> Self {
32 Self::Custom(val.into())
33 }
34}
35
36impl std::error::Error for Error {}
41
42