diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:41:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:41:35 +0000 |
commit | 7e5d7eea9c580ef4b41a765bde624af431942b96 (patch) | |
tree | 2c0d9ca12878fc4525650aa4e54d77a81a07cc09 /vendor/gix-config-value/src/lib.rs | |
parent | Adding debian version 1.70.0+dfsg1-9. (diff) | |
download | rustc-7e5d7eea9c580ef4b41a765bde624af431942b96.tar.xz rustc-7e5d7eea9c580ef4b41a765bde624af431942b96.zip |
Merging upstream version 1.70.0+dfsg2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix-config-value/src/lib.rs')
-rw-r--r-- | vendor/gix-config-value/src/lib.rs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/vendor/gix-config-value/src/lib.rs b/vendor/gix-config-value/src/lib.rs new file mode 100644 index 000000000..130674e5a --- /dev/null +++ b/vendor/gix-config-value/src/lib.rs @@ -0,0 +1,47 @@ +//! Parsing for data types used in `gix-config` files to allow their use from environment variables and other sources. +//! +//! ## Feature Flags +#![cfg_attr( + feature = "document-features", + cfg_attr(doc, doc = ::document_features::document_features!()) +)] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] +#![deny(missing_docs, rust_2018_idioms, unsafe_code)] + +/// The error returned when any config value couldn't be instantiated due to malformed input. +#[derive(Debug, thiserror::Error, Eq, PartialEq)] +#[allow(missing_docs)] +#[error("Could not decode '{input}': {message}")] +pub struct Error { + pub message: &'static str, + pub input: bstr::BString, + #[source] + pub utf8_err: Option<std::str::Utf8Error>, +} + +impl Error { + /// Create a new value error from `message`, with `input` being what's causing the error. + pub fn new(message: &'static str, input: impl Into<bstr::BString>) -> Self { + Error { + message, + input: input.into(), + utf8_err: None, + } + } + + pub(crate) fn with_err(mut self, err: std::str::Utf8Error) -> Self { + self.utf8_err = Some(err); + self + } +} + +mod boolean; +/// +pub mod color; +/// +pub mod integer; +/// +pub mod path; + +mod types; +pub use types::{Boolean, Color, Integer, Path}; |