1#![cfg_attr(
5 feature = "document-features",
6 cfg_attr(doc, doc = ::document_features::document_features!())
7)]
8#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
9#![deny(missing_docs, rust_2018_idioms, unsafe_code)]
10
11#[derive(Debug, thiserror::Error, Eq, PartialEq)]
13#[allow(missing_docs)]
14#[error("Could not decode '{input}': {message}")]
15pub struct Error {
16 pub message: &'static str,
17 pub input: bstr::BString,
18 #[source]
19 pub utf8_err: Option<std::str::Utf8Error>,
20}
21
22impl Error {
23 pub fn new(message: &'static str, input: impl Into<bstr::BString>) -> Self {
25 Error {
26 message,
27 input: input.into(),
28 utf8_err: None,
29 }
30 }
31
32 pub(crate) fn with_err(mut self, err: std::str::Utf8Error) -> Self {
33 self.utf8_err = Some(err);
34 self
35 }
36}
37
38mod boolean;
39pub mod color;
41pub mod integer;
43pub mod path;
45
46mod types;
47pub use types::{Boolean, Color, Integer, Path};