pub trait AsRefStrExt {
    // Required methods
    fn to_dos(&self) -> Cow<'_, str>;
    fn to_unix(&self) -> Cow<'_, str>;
}
Expand description

Extension trait for converting between DOS and UNIX linebreaks.

Required Methods§

source

fn to_dos(&self) -> Cow<'_, str>

Converts linebreaks to DOS (\r\n). See unix2dos for more info.

Examples
use newline_converter::AsRefStrExt;
assert_eq!("foo\r\nbar", "foo\nbar".to_dos());
source

fn to_unix(&self) -> Cow<'_, str>

Converts linebreaks to UNIX (\n). See dos2unix for more info.

Examples
use newline_converter::AsRefStrExt;
assert_eq!("foo\nbar", "foo\r\nbar".to_unix());

Implementors§

source§

impl<T> AsRefStrExt for Twhere T: AsRef<str>,