summaryrefslogtreecommitdiff
path: root/src/model/array.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/array.rs
parent038f9b015ee1248c3636c5e1b2edb5c4767ed837 (diff)
Mutable methods with return values
Diffstat (limited to 'src/model/array.rs')
-rw-r--r--src/model/array.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/model/array.rs b/src/model/array.rs
index 06d1b588..02607547 100644
--- a/src/model/array.rs
+++ b/src/model/array.rs
@@ -93,15 +93,14 @@ impl Array {
}
/// Remove and return the value at the specified index.
- pub fn remove(&mut self, index: i64) -> StrResult<()> {
+ pub fn remove(&mut self, index: i64) -> StrResult<Value> {
let len = self.len();
let i = self
.locate(index)
.filter(|&i| i < self.0.len())
.ok_or_else(|| out_of_bounds(index, len))?;
- Arc::make_mut(&mut self.0).remove(i);
- Ok(())
+ Ok(Arc::make_mut(&mut self.0).remove(i))
}
/// Extract a contigous subregion of the array.