summaryrefslogtreecommitdiffstats
path: root/vendor/gix-config-value/src/lib.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:41:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:41:41 +0000
commit10ee2acdd26a7f1298c6f6d6b7af9b469fe29b87 (patch)
treebdffd5d80c26cf4a7a518281a204be1ace85b4c1 /vendor/gix-config-value/src/lib.rs
parentReleasing progress-linux version 1.70.0+dfsg1-9~progress7.99u1. (diff)
downloadrustc-10ee2acdd26a7f1298c6f6d6b7af9b469fe29b87.tar.xz
rustc-10ee2acdd26a7f1298c6f6d6b7af9b469fe29b87.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.rs47
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};