stdto_core/
error.rs

1#[non_exhaustive]
2#[derive(thiserror::Error, Debug)]
3pub enum Error {
4    #[cfg(feature = "bytes")]
5    #[error("bytes conversion error: {0}")]
6    Bytes(#[from] bincode::Error),
7
8    #[cfg(feature = "json")]
9    #[error("json conversion error: {0}")]
10    Json(#[from] serde_json::Error),
11
12    #[cfg(feature = "yaml")]
13    #[error("yaml conversion error: {0}")]
14    Yaml(#[from] serde_yaml::Error),
15
16    #[cfg(feature = "toml")]
17    #[error("toml conversion error: {0}")]
18    TomlSerialize(#[from] toml::ser::Error),
19    #[cfg(feature = "toml")]
20    #[error("toml conversion error: {0}")]
21    TomlDeserialize(#[from] toml::de::Error),
22
23    #[error("io error: {0}")]
24    Io(#[from] std::io::Error),
25    #[error("fmt error: {0}")]
26    Fmt(#[from] std::fmt::Error),
27    #[error("utf error: {0}")]
28    Utf8(#[from] std::str::Utf8Error),
29    #[error("parse int error: {0}")]
30    ParseInt(#[from] std::num::ParseIntError),
31    #[error("out of bounds error: {0} < {1}")]
32    OutOfBounds(usize, usize),
33    #[error("odd length")]
34    OddLength,
35}
36
37pub type Result<T> = std::result::Result<T, Error>;