use alloc::borrow::Cow;
pub trait ReplaceNewlinesWithSpace<'a> {
fn replace_newlines_with_space(self) -> Cow<'a, str>;
}
impl<'a> ReplaceNewlinesWithSpace<'a> for &'a str {
#[inline]
fn replace_newlines_with_space(self) -> Cow<'a, str> {
crate::newlines::replace_newlines_with(self, b' ')
}
}
impl<'a> ReplaceNewlinesWithSpace<'a> for Cow<'a, str> {
#[inline]
fn replace_newlines_with_space(self) -> Cow<'a, str> {
match self {
Cow::Borrowed(s) => s.replace_newlines_with_space(),
Cow::Owned(s) => {
Cow::Owned(crate::cow_into_owned!(s, s.as_str().replace_newlines_with_space(),))
},
}
}
}