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

# Struct collections::str::Chars 1.0.0 [−] [src]

    pub struct Chars<'a> { /* fields omitted */ }

An iterator over the `char`s of a string slice.

This struct is created by the `chars` method on `str`. See its documentation for more.

## Methods

### `impl<'a> Chars<'a>`
[src]

#### `fn as_str(&self) -> &'a str`
1.4.0

View the underlying data as a subslice of the original data.

This has the same lifetime as the original slice, and so the iterator can continue to be used while this exists.

# Examples

    let mut chars = "abc".chars();

    assert_eq!(chars.as_str(), "abc");
    chars.next();
    assert_eq!(chars.as_str(), "bc");
    chars.next();
    chars.next();
    assert_eq!(chars.as_str(), "");

## Trait Implementations

### `impl<'a> Debug for Chars<'a>`
[src]

#### `fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), Error>`

Formats the value using the given formatter.

### `impl<'a> Clone for Chars<'a>`
[src]

#### `fn clone(&self) -> Chars<'a>`

### `impl<'a> FusedIterator for Chars<'a>`
[src]

### `impl<'a> Iterator for Chars<'a>`
[src]

#### `type Item = char`

#### `fn next(&mut self) -> Option<char>`

#### `fn count(self) -> usize`

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

#### `fn last(self) -> Option<char>`

### `impl<'a> DoubleEndedIterator for Chars<'a>`
[src]

#### `fn next_back(&mut self) -> Option<char>`

# 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`)