From 10ee2acdd26a7f1298c6f6d6b7af9b469fe29b87 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 14:41:41 +0200 Subject: Merging upstream version 1.70.0+dfsg2. Signed-off-by: Daniel Baumann --- vendor/gix-config-value/src/lib.rs | 47 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 vendor/gix-config-value/src/lib.rs (limited to 'vendor/gix-config-value/src/lib.rs') 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, +} + +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) -> 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}; -- cgit v1.2.3