summaryrefslogtreecommitdiff
path: root/src/model/dict.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-12-21 23:48:04 +0100
committerLaurenz <laurmaedje@gmail.com>2022-12-21 23:48:04 +0100
commit1eda162867afab656ec9b95c85f725cd676d4f04 (patch)
treee349d3ddb709701c9997fead0869c5390fbb3ec4 /src/model/dict.rs
parent038f9b015ee1248c3636c5e1b2edb5c4767ed837 (diff)
Mutable methods with return values
Diffstat (limited to 'src/model/dict.rs')
-rw-r--r--src/model/dict.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/model/dict.rs b/src/model/dict.rs
index 6e014d7e..e3c5454e 100644
--- a/src/model/dict.rs
+++ b/src/model/dict.rs
@@ -79,10 +79,10 @@ impl Dict {
Arc::make_mut(&mut self.0).insert(key, value);
}
- /// Remove a mapping by `key`.
- pub fn remove(&mut self, key: &str) -> StrResult<()> {
+ /// Remove a mapping by `key` and return the value.
+ pub fn remove(&mut self, key: &str) -> StrResult<Value> {
match Arc::make_mut(&mut self.0).remove(key) {
- Some(_) => Ok(()),
+ Some(value) => Ok(value),
None => Err(missing_key(key)),
}
}