diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/confindent.rs | 4 | ||||
| -rwxr-xr-x | src/lib.rs | 4 |
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() |
