about summary refs log tree commit diff
path: root/src
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 /src
parentf66317c8df497256e5aca6685c58cd7e3f6dc217 (diff)
downloadscurvy-main.tar.gz
scurvy-main.zip
add has() to check if option is present HEAD 0.3.1 main
Diffstat (limited to 'src')
-rw-r--r--src/confindent.rs4
-rwxr-xr-xsrc/lib.rs4
2 files changed, 8 insertions, 0 deletions
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()