pub trait ReplaceNewlinesWithSpace<'a> {
// Required method
fn replace_newlines_with_space(self) -> Cow<'a, str>;
}Available on crate feature
alloc only.Expand description
To extend str and Cow<str> to have replace_newlines_with_space method.
This can be useful when you need to normalize multiline strings into a single line for logging, database storage, or display purposes.
Required Methods§
Sourcefn replace_newlines_with_space(self) -> Cow<'a, str>
fn replace_newlines_with_space(self) -> Cow<'a, str>
Returns a Cow<str> where all newline sequences are replaced with a space.
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".