pub trait NormalizeNewlines<'a> {
// Required method
fn normalize_newlines(self) -> Cow<'a, str>;
}Available on crate feature
alloc only.Expand description
To extend str and Cow<str> to have normalize_newlines method.
This converts Unicode newline sequences to LF (\n) while avoiding allocation when the text is already normalized.
Required Methods§
Sourcefn normalize_newlines(self) -> Cow<'a, str>
fn normalize_newlines(self) -> Cow<'a, str>
Returns a Cow<str> where newline sequences are normalized to LF (\n).
Handles LF, VT, FF, CRLF, CR, NEL, LS, and PS. CRLF is treated as one newline sequence.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".