collections::vec::IntoIter - Rust
Description: API documentation for the Rust `IntoIter` struct in crate `collections`.
Keywords: rust, rustlang, rust-lang, IntoIter

# Struct collections::vec::IntoIter 1.0.0 [−] [src]

    pub struct IntoIter<T> { /* fields omitted */ }

An iterator that moves out of a vector.

This `struct` is created by the `into_iter` method on `Vec` (provided by the `IntoIterator` trait).

## Methods

### `impl<T> IntoIter<T>`
[src]

#### `fn as_slice(&self) -> &[T]`
1.15.0
[src]

Returns the remaining items of this iterator as a slice.

# Examples

    let vec = vec!['a', 'b', 'c'];
    let mut into_iter = vec.into_iter();
    assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
    let _ = into_iter.next().unwrap();
    assert_eq!(into_iter.as_slice(), &['b', 'c']);

#### `fn as_mut_slice(&mut self) -> &mut [T]`
1.15.0
[src]

Returns the remaining items of this iterator as a mutable slice.

# Examples

    let vec = vec!['a', 'b', 'c'];
    let mut into_iter = vec.into_iter();
    assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
    into_iter.as_mut_slice()[2] = 'z';
    assert_eq!(into_iter.next().unwrap(), 'a');
    assert_eq!(into_iter.next().unwrap(), 'b');
    assert_eq!(into_iter.next().unwrap(), 'z');

## Trait Implementations

### `impl<T> ExactSizeIterator for IntoIter<T>`
[src]

#### `fn is_empty(&self) -> bool`
[src]

### `impl<T> Sync for IntoIter<T> where
T: Sync,`
[src]

### `impl<T> DoubleEndedIterator for IntoIter<T>`
[src]

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

### `impl<T> FusedIterator for IntoIter<T>`
[src]

### `impl<T> Drop for IntoIter<T>`
[src]

#### `fn drop(&mut self)`
[src]

### `impl<T> Send for IntoIter<T> where
T: Send,`
[src]

### `impl<T> Clone for IntoIter<T> where
T: Clone,`
1.8.0
[src]

#### `fn clone(&self) -> IntoIter<T>`
[src]

### `impl<T> Debug for IntoIter<T> where
T: Debug,`
1.13.0
[src]

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

Formats the value using the given formatter.

### `impl<T> Iterator for IntoIter<T>`
[src]

#### `type Item = T`

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

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

#### `fn count(self) -> usize`
[src]

### `impl<T> TrustedLen for IntoIter<T>`
[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`)