StrExt

Trait StrExt 

Source
pub trait StrExt {
    // Required methods
    fn trim_comment(&self) -> &str;
    fn parse_num<N: ParseNumber>(&self) -> Result<N, ParseNumberError>;
    fn parse_with_limits<N: ParseNumber>(
        &self,
        limit: N,
    ) -> Result<N, ParseNumberError>;
    fn to_standardized_path(&self) -> String;
    fn clean_filename(&self) -> String;
}
Expand description

Extension methods for str which are commonly used in and around this library.

Required Methods§

Source

fn trim_comment(&self) -> &str

Trim trailing comments and whitespace.

Source

fn parse_num<N: ParseNumber>(&self) -> Result<N, ParseNumberError>

Parse &str to a number without exceeding MAX_PARSE_VALUE.

Source

fn parse_with_limits<N: ParseNumber>( &self, limit: N, ) -> Result<N, ParseNumberError>

Parse &str to a number without exceeding the given limit.

Source

fn to_standardized_path(&self) -> String

Replace windows path separators with unix ones.

Source

fn clean_filename(&self) -> String

Fix path and quotation segments to normalize filenames.

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 StrExt for str

Implementors§