summaryrefslogtreecommitdiff
path: root/src/eval/dict.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-05-03 15:58:15 +0200
committerLaurenz <laurmaedje@gmail.com>2022-05-03 15:58:15 +0200
commitd59109e8fffa1d0b03234329e12f5d3e578804e8 (patch)
treefe7453da6f2ae327993e5ca6436ddc6a448a2c41 /src/eval/dict.rs
parentf77f1f61bf05ae506689be3c40252c5807276280 (diff)
Support recursive show rules
Diffstat (limited to 'src/eval/dict.rs')
-rw-r--r--src/eval/dict.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/eval/dict.rs b/src/eval/dict.rs
index b630fc63..bda433e1 100644
--- a/src/eval/dict.rs
+++ b/src/eval/dict.rs
@@ -46,8 +46,8 @@ impl Dict {
}
/// Borrow the value the given `key` maps to.
- pub fn get(&self, key: EcoString) -> StrResult<&Value> {
- self.0.get(&key).ok_or_else(|| missing_key(&key))
+ pub fn get(&self, key: &EcoString) -> StrResult<&Value> {
+ self.0.get(key).ok_or_else(|| missing_key(key))
}
/// Mutably borrow the value the given `key` maps to.
@@ -59,7 +59,7 @@ impl Dict {
}
/// Whether the dictionary contains a specific key.
- pub fn contains(&self, key: &str) -> bool {
+ pub fn contains(&self, key: &EcoString) -> bool {
self.0.contains_key(key)
}
@@ -69,10 +69,10 @@ impl Dict {
}
/// Remove a mapping by `key`.
- pub fn remove(&mut self, key: EcoString) -> StrResult<()> {
- match Arc::make_mut(&mut self.0).remove(&key) {
+ pub fn remove(&mut self, key: &EcoString) -> StrResult<()> {
+ match Arc::make_mut(&mut self.0).remove(key) {
Some(_) => Ok(()),
- None => Err(missing_key(&key)),
+ None => Err(missing_key(key)),
}
}