Skip to main content

StrExt

Trait StrExt 

Source
pub trait StrExt: AsRef<str> {
    // Required methods
    fn utf8chars(&self) -> Utf8Chars<'_> ;
    fn utf16chars(&self) -> Utf16Chars<'_> ;
    fn utf8char_indices(&self) -> Utf8CharIndices<'_> ;
    fn utf16char_indices(&self) -> Utf16CharIndices<'_> ;
}
Expand description

Adds .utf8chars() and .utf16chars() iterator constructors to &str.

Required Methods§

Source

fn utf8chars(&self) -> Utf8Chars<'_>

Equivalent to .chars() but produces Utf8Chars.

Source

fn utf16chars(&self) -> Utf16Chars<'_>

Equivalent to .chars() but produces Utf16Chars.

Source

fn utf8char_indices(&self) -> Utf8CharIndices<'_>

Equivalent to .char_indices() but produces Utf8Chars.

Source

fn utf16char_indices(&self) -> Utf16CharIndices<'_>

Equivalent to .char_indices() but produces Utf16Chars.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl StrExt for str

Implementors§