Skip to main content

Trim

Trait Trim 

Source
pub trait Trim<'a> {
    // Required methods
    fn trim_cow(self) -> Cow<'a, str>;
    fn trim_start_cow(self) -> Cow<'a, str>;
    fn trim_end_cow(self) -> Cow<'a, str>;
    fn trim_matches_cow<P: Pattern>(self, pat: P) -> Cow<'a, str>;
    fn trim_start_matches_cow<P: Pattern>(self, pat: P) -> Cow<'a, str>;
    fn trim_end_matches_cow<P: Pattern>(self, pat: P) -> Cow<'a, str>;
    fn trim_ascii_cow(self) -> Cow<'a, str>;
    fn trim_ascii_start_cow(self) -> Cow<'a, str>;
    fn trim_ascii_end_cow(self) -> Cow<'a, str>;
}
Available on crate feature alloc only.
Expand description

To extend Cow<str> with methods corresponding to the standard library trimming methods.

Required Methods§

Source

fn trim_cow(self) -> Cow<'a, str>

Trims both leading and trailing Unicode whitespace characters.

Source

fn trim_start_cow(self) -> Cow<'a, str>

Trims leading (left) Unicode whitespace characters.

Source

fn trim_end_cow(self) -> Cow<'a, str>

Trims trailing (right) Unicode whitespace characters.

Source

fn trim_matches_cow<P: Pattern>(self, pat: P) -> Cow<'a, str>

Trims all prefixes and suffixes that match a pattern.

Source

fn trim_start_matches_cow<P: Pattern>(self, pat: P) -> Cow<'a, str>

Trims all prefixes that match a pattern.

Source

fn trim_end_matches_cow<P: Pattern>(self, pat: P) -> Cow<'a, str>

Trims all suffixes that match a pattern.

Source

fn trim_ascii_cow(self) -> Cow<'a, str>

Trims both leading and trailing ASCII whitespace characters.

Source

fn trim_ascii_start_cow(self) -> Cow<'a, str>

Trims leading (left) ASCII whitespace characters.

Source

fn trim_ascii_end_cow(self) -> Cow<'a, str>

Trims trailing (right) ASCII whitespace characters.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<'a> Trim<'a> for Cow<'a, str>

Source§

fn trim_cow(self) -> Cow<'a, str>

Source§

fn trim_start_cow(self) -> Cow<'a, str>

Source§

fn trim_end_cow(self) -> Cow<'a, str>

Source§

fn trim_matches_cow<P: Pattern>(self, pat: P) -> Cow<'a, str>

Source§

fn trim_start_matches_cow<P: Pattern>(self, pat: P) -> Cow<'a, str>

Source§

fn trim_end_matches_cow<P: Pattern>(self, pat: P) -> Cow<'a, str>

Source§

fn trim_ascii_cow(self) -> Cow<'a, str>

Source§

fn trim_ascii_start_cow(self) -> Cow<'a, str>

Source§

fn trim_ascii_end_cow(self) -> Cow<'a, str>

Implementors§