pub struct IterMut<'a, T: 'a> { /* private fields */ }Expand description
Mutable slice iterator.
This struct is created by the iter_mut method on slices.
§Examples
Basic usage:
// First, we need a slice to call the `iter_mut` method on:
let slice = &mut [1, 2, 3];
// Then we call `iter_mut` on the slice to get the `IterMut` iterator,
// iterate over it and increment each element value:
for element in slice.iter_mut() {
*element += 1;
}
// We now have "[2, 3, 4]":
println!("{slice:?}");Trait Implementations§
1.0.0 · Source§impl<'a, T> Iterator for IterMut<'a, T>
impl<'a, T> Iterator for IterMut<'a, T>
Source§fn next(&mut self) -> Option<&'a mut T>
fn next(&mut self) -> Option<&'a mut T>
Advances the iterator and returns the next value. Read more
1.0.0 · Source§fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. Read more