diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-12-21 23:48:04 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-12-21 23:48:04 +0100 |
| commit | 1eda162867afab656ec9b95c85f725cd676d4f04 (patch) | |
| tree | e349d3ddb709701c9997fead0869c5390fbb3ec4 /src/model/array.rs | |
| parent | 038f9b015ee1248c3636c5e1b2edb5c4767ed837 (diff) | |
Mutable methods with return values
Diffstat (limited to 'src/model/array.rs')
| -rw-r--r-- | src/model/array.rs | 5 |
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. |
