Skip to main content

StrMutExt

Trait StrMutExt 

Source
pub(crate) trait StrMutExt {
    // Required methods
    fn truncate_newline(&mut self) -> bool;
    fn truncate_end_whitespaces(&mut self);
    fn append_ellipsis(&mut self);
    fn strip_nul(&mut self);

    // Provided method
    fn clean_string(&mut self) { ... }
}
Expand description

Common extensions to mutable strings.

Required Methods§

Source

fn truncate_newline(&mut self) -> bool

Truncate this string at the first newline.

Appends an ellipsis if the string was truncated.

Returns true if the string was truncated.

Source

fn truncate_end_whitespaces(&mut self)

Truncate whitespaces at the end of the string.

Source

fn append_ellipsis(&mut self)

Append an ellipsis, except if this string already ends with an ellipsis.

Source

fn strip_nul(&mut self)

Strip the NUL byte.

Since they are used by GTK as the end of a string, strings in properties will be truncated at the first NUL byte.

Provided Methods§

Source

fn clean_string(&mut self)

Remove unnecessary or problematic characters from the string.

Implementations on Foreign Types§

Source§

impl StrMutExt for String

Implementors§