# Struct collections::linked_list::IterMut 1.0.0 [−] [src]

    pub struct IterMut<'a, T> where
        T: 'a,  { /* fields omitted */ }

A mutable iterator over the elements of a `LinkedList`.

This `struct` is created by the `iter_mut` method on `LinkedList`. See its documentation for more.

## Methods

### `impl<'a, T> IterMut<'a, T>`
[src]

#### `fn insert_next(&mut self, element: T)`
[src]

🔬 This is a nightly-only experimental API. (`linked_list_extras` #27794)

this is probably better handled by a cursor type -- we'll see

Inserts the given element just after the element most recently returned by `.next()`. The inserted element does not appear in the iteration.

# Examples

    #![feature(linked_list_extras)]

    use std::collections::LinkedList;

    let mut list: LinkedList<_> = vec![1, 3, 4].into_iter().collect();

    {
        let mut it = list.iter_mut();
        assert_eq!(it.next().unwrap(), &1);
        // insert `2` after `1`
        it.insert_next(2);
    }
    {
        let vec: Vec<_> = list.into_iter().collect();
        assert_eq!(vec, [1, 2, 3, 4]);
    }

#### `fn peek_next(&mut self) -> Option<&mut T>`
[src]

🔬 This is a nightly-only experimental API. (`linked_list_extras` #27794)

this is probably better handled by a cursor type -- we'll see

Provides a reference to the next element, without changing the iterator.

# Examples

    #![feature(linked_list_extras)]

    use std::collections::LinkedList;

    let mut list: LinkedList<_> = vec![1, 2, 3].into_iter().collect();

    let mut it = list.iter_mut();
    assert_eq!(it.next().unwrap(), &1);
    assert_eq!(it.peek_next().unwrap(), &2);
    // We just peeked at 2, so it was not consumed from the iterator.
    assert_eq!(it.next().unwrap(), &2);

## Trait Implementations

### `impl<'a, T> Iterator for IterMut<'a, T>`
[src]

#### `type Item = &'a mut T`

#### `fn next(&mut self) -> Option<&'a mut T>`
[src]

#### `fn size_hint(&self) -> (usize, Option<usize>)`
[src]

### `impl<'a, T> FusedIterator for IterMut<'a, T>`
[src]

### `impl<'a, T> DoubleEndedIterator for IterMut<'a, T>`
[src]

#### `fn next_back(&mut self) -> Option<&'a mut T>`
[src]

### `impl<'a, T> ExactSizeIterator for IterMut<'a, T>`
[src]

### `impl<'a, T> Send for IterMut<'a, T> where
T: Send,`
[src]

### `impl<'a, T> Debug for IterMut<'a, T> where
T: 'a + Debug,`
1.17.0
[src]

#### `fn fmt(&self, f: &mut Formatter) -> Result<(), Error>`
[src]

Formats the value using the given formatter.

### `impl<'a, T> Sync for IterMut<'a, T> where
T: Sync,`
[src]

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)