-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit 0b4d84d
committed
Add StreamingIteratorMut and DoubleEndedStreamingIteratorMut
These are extensions of their non-`Mut` counterparts, in short:
```rust
pub trait StreamingIteratorMut: StreamingIterator {
fn get_mut(&mut self) -> Option<&mut Self::Item>;
fn next_mut(&mut self) -> Option<&mut Self::Item>;
fn fold_mut<B, F>(mut self, init: B, mut f: F) -> B
where
Self: Sized,
F: FnMut(B, &mut Self::Item) -> B;
fn for_each_mut<F>(self, mut f: F)
where
Self: Sized,
F: FnMut(&mut Self::Item);
}
pub trait DoubleEndedStreamingIteratorMut:
DoubleEndedStreamingIterator + StreamingIteratorMut
{
fn next_back_mut(&mut self) -> Option<&mut Self::Item>;
fn rfold_mut<B, F>(mut self, init: B, mut f: F) -> B
where
Self: Sized,
F: FnMut(B, &mut Self::Item) -> B;
}
```
Only `get_mut` is required, and the rest have default implementations.
There is also a new conversion from `Iterator`:
```rust
pub fn convert_mut<'a, I, T: ?Sized>(iterator: I) -> ConvertMut<'a, I::IntoIter, T>
where
I: IntoIterator<Item = &'a mut T>;
```1 parent 95f909d commit 0b4d84dCopy full SHA for 0b4d84d
File tree
Expand file treeCollapse file tree
2 files changed
+758
-0
lines changedFilter options
- src
Expand file treeCollapse file tree
2 files changed
+758
-0
lines changed
0 commit comments