Skip to main content

TrimLine

Trait TrimLine 

Source
pub trait TrimLine: Sized {
    // Required methods
    fn trim_line(self) -> Self;
    fn trim_line_start(self) -> Self;
    fn trim_line_end(self) -> Self;
}
Expand description

To extend str and Cow<str> with methods that trim empty lines.

Lines are separated only by LF (\n), and a line is empty when all of its characters are Unicode whitespace.

Required Methods§

Source

fn trim_line(self) -> Self

Trims empty lines from both ends of the string.

Source

fn trim_line_start(self) -> Self

Trims empty lines from the start of the string.

Source

fn trim_line_end(self) -> Self

Trims empty lines from the end of the string.

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 TrimLine for &str

Source§

fn trim_line(self) -> Self

Source§

fn trim_line_start(self) -> Self

Source§

fn trim_line_end(self) -> Self

Source§

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

Available on crate feature alloc only.
Source§

fn trim_line(self) -> Self

Source§

fn trim_line_start(self) -> Self

Source§

fn trim_line_end(self) -> Self

Implementors§