Editer
Editer allows mutating a collection in place while iterating over it.
Quick links
Usage
The edit function iterates over a given List. For each item in the list, it calls a given
function with a Slot. The Slot can be used to access the current item and/or mutate the list
at the current position. You can:
-
Insert zero or more new items before or after the current item using
Slot::insert_beforeorSlot::insert_after.use edit; let mut items = vec!; edit; assert_eq!; -
Replace the current item with zero or more new items using
DerefMut::deref_mutorSlot::replace.let mut items = vec!; edit; assert_eq!; -
Remove the current item using
Slot::remove.let mut items = vec!; edit; assert_eq!;
try_edit is the fallible version of edit. It applies the given editor function to each item
in the given list, like edit. It stops at the first error and returns it.
use try_edit;
let mut items = vec!;
let result = try_edit;
assert_eq!;
assert_eq!;
Requirements
Editer requires Rust 1.57 or newer.
License
Editer is distributed under the terms of the MIT License. See LICENSE for details.