whatwg_infra::strings

Trait InfraStr

Source
pub trait InfraStr {
    // Required methods
    fn normalize_newlines(&self) -> String;
    fn strip_newlines(&self) -> String;
    fn trim_ascii_whitespace(&self) -> &str;
    fn trim_collapse_ascii_whitespace(&self) -> String;
    fn collect_codepoints<P>(
        &self,
        position: &mut usize,
        predicate: P,
    ) -> String
       where P: Fn(char) -> bool;
    fn skip_codepoints<P>(&self, position: &mut usize, predicate: P)
       where P: Fn(char) -> bool;
    fn skip_ascii_whitespace(&self, position: &mut usize);
}
Expand description

Methods from the WHATWG Infra Standard for strings

Required Methods§

Source

fn normalize_newlines(&self) -> String

See the documentation for normalize_newlines()

Source

fn strip_newlines(&self) -> String

See the documentation for strip_newlines()

Source

fn trim_ascii_whitespace(&self) -> &str

See the documentation for trim_ascii_whitespace()

Source

fn trim_collapse_ascii_whitespace(&self) -> String

See the documentation for trim_collapse_ascii_whitespace()

Source

fn collect_codepoints<P>(&self, position: &mut usize, predicate: P) -> String
where P: Fn(char) -> bool,

See the documentation for collect_codepoints()

Source

fn skip_codepoints<P>(&self, position: &mut usize, predicate: P)
where P: Fn(char) -> bool,

See the documentation for skip_codepoints()

Source

fn skip_ascii_whitespace(&self, position: &mut usize)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl InfraStr for str

Source§

fn normalize_newlines(&self) -> String

Source§

fn strip_newlines(&self) -> String

Source§

fn trim_ascii_whitespace(&self) -> &str

Source§

fn trim_collapse_ascii_whitespace(&self) -> String

Source§

fn collect_codepoints<P>(&self, position: &mut usize, predicate: P) -> String
where P: Fn(char) -> bool,

Source§

fn skip_codepoints<P>(&self, position: &mut usize, predicate: P)
where P: Fn(char) -> bool,

Source§

fn skip_ascii_whitespace(&self, position: &mut usize)

Source§

impl InfraStr for String

Source§

fn normalize_newlines(&self) -> String

Source§

fn strip_newlines(&self) -> String

Source§

fn trim_ascii_whitespace(&self) -> &str

Source§

fn trim_collapse_ascii_whitespace(&self) -> String

Source§

fn collect_codepoints<P>(&self, position: &mut usize, predicate: P) -> String
where P: Fn(char) -> bool,

Source§

fn skip_codepoints<P>(&self, position: &mut usize, predicate: P)
where P: Fn(char) -> bool,

Source§

fn skip_ascii_whitespace(&self, position: &mut usize)

Implementors§