Struct IntoChars

struct IntoChars { ... }

An iterator over the chars of a string.

This struct is created by the into_chars method on String. See its documentation for more.

Implementations

impl IntoChars

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

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

Examples

#![feature(string_into_chars)]

let mut chars = String::from("abc").into_chars();

assert_eq!(chars.as_str(), "abc");
chars.next();
assert_eq!(chars.as_str(), "bc");
chars.next();
chars.next();
assert_eq!(chars.as_str(), "");
fn into_string(self: Self) -> String

Consumes the IntoChars, returning the remaining string.

Examples

#![feature(string_into_chars)]

let chars = String::from("abc").into_chars();
assert_eq!(chars.into_string(), "abc");

let mut chars = String::from("def").into_chars();
chars.next();
assert_eq!(chars.into_string(), "ef");

impl Clone for IntoChars

fn clone(self: &Self) -> IntoChars

impl Debug for IntoChars

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

impl DoubleEndedIterator for IntoChars

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

impl Freeze for IntoChars

impl FusedIterator for IntoChars

impl Iterator for IntoChars

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

impl RefUnwindSafe for IntoChars

impl Send for IntoChars

impl Sync for IntoChars

impl Unpin for IntoChars

impl UnwindSafe for IntoChars

impl<I> IntoIterator for IntoChars

fn into_iter(self: Self) -> I

impl<T> Any for IntoChars

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for IntoChars

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

impl<T> BorrowMut for IntoChars

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

impl<T> CloneToUninit for IntoChars

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

impl<T> From for IntoChars

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for IntoChars

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for IntoChars

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 IntoChars

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

impl<T, U> TryInto for IntoChars

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