Struct Chars

struct Chars<'a> { ... }

An iterator over the chars of a string slice.

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

Implementations

impl<'a> Chars<'a>

fn as_str(self: &Self) -> &'a str

Views 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(), "");

impl Debug for Chars<'_>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl FusedIterator for Chars<'_>

impl<'a> Clone for Chars<'a>

fn clone(self: &Self) -> Chars<'a>

impl<'a> DoubleEndedIterator for Chars<'a>

fn next_back(self: &mut Self) -> Option<char>

impl<'a> Freeze for Chars<'a>

impl<'a> Iterator for Chars<'a>

fn next(self: &mut Self) -> Option<char>
fn count(self: Self) -> usize
fn advance_by(self: &mut Self, remainder: usize) -> Result<(), NonZero<usize>>
fn size_hint(self: &Self) -> (usize, Option<usize>)
fn last(self: Self) -> Option<char>

impl<'a> RefUnwindSafe for Chars<'a>

impl<'a> Send for Chars<'a>

impl<'a> Sync for Chars<'a>

impl<'a> Unpin for Chars<'a>

impl<'a> UnsafeUnpin for Chars<'a>

impl<'a> UnwindSafe for Chars<'a>

impl<I> IntoIterator for Chars<'a>

fn into_iter(self: Self) -> I

impl<T> Any for Chars<'a>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Chars<'a>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Chars<'a>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Chars<'a>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Chars<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Chars<'a>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Chars<'a>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Chars<'a>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>