about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgennyble <gen@nyble.dev>2026-07-15 18:20:36 -0500
committergennyble <gen@nyble.dev>2026-07-15 18:20:36 -0500
commit2a6fe2dcd206d6acc58801920ce74c9f0b0afa93 (patch)
treeb59a6bf695db423c5e9702d4a7fb50c3edfe2b19
parentf66317c8df497256e5aca6685c58cd7e3f6dc217 (diff)
downloadscurvy-main.tar.gz
scurvy-main.zip
add has() to check if option is present HEAD 0.3.1 main
-rwxr-xr-xCargo.lock2
-rwxr-xr-xCargo.toml2
-rw-r--r--src/confindent.rs4
-rwxr-xr-xsrc/lib.rs4
4 files changed, 10 insertions, 2 deletions
diff --git a/Cargo.lock b/Cargo.lock
index fed34f1..383347d 100755
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -16,7 +16,7 @@ checksum = "ea618ded77af626818bde0f0802da7c20d47e38e23e37be40f6f807a76079e82"
 
 [[package]]
 name = "scurvy"
-version = "0.3.0"
+version = "0.3.1"
 dependencies = [
  "camino",
  "confindent",
diff --git a/Cargo.toml b/Cargo.toml
index 1ac84b4..6cf5223 100755
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "scurvy"
-version = "0.3.0"
+version = "0.3.1"
 edition = "2024"
 
 [dependencies]
diff --git a/src/confindent.rs b/src/confindent.rs
index 40ea3a2..0b9f4f5 100644
--- a/src/confindent.rs
+++ b/src/confindent.rs
@@ -47,6 +47,10 @@ impl ConfigurationPair {
 }
 
 impl ConfigurationPair {
+	pub fn has<K: Into<ConfigurationKey<'static>>>(&self, key: K) -> bool {
+		self.get(key).is_some()
+	}
+
 	pub fn get<K: Into<ConfigurationKey<'static>>>(&self, key: K) -> Option<&str> {
 		let key = key.into();
 		self.scurvy
diff --git a/src/lib.rs b/src/lib.rs
index 3b30885..a62fdb3 100755
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -76,6 +76,10 @@ impl Scurvy {
 		self.pairs.iter().find(|p| p.key.matches(key))
 	}
 
+	pub fn has(&self, key: &str) -> bool {
+		self.get(key).is_some()
+	}
+
 	pub fn get(&self, key: &str) -> Option<&str> {
 		self.pairs
 			.iter()