use crate::{
alloc::AllocRef,
borrow::{Borrow, BorrowMut},
boxed::Box,
string::String,
};
#[allow(deprecated)]
pub use liballoc::str::LinesAny;
pub use liballoc::str::{
from_utf8,
from_utf8_mut,
from_utf8_unchecked,
from_utf8_unchecked_mut,
Bytes,
CharIndices,
Chars,
EncodeUtf16,
EscapeDebug,
EscapeDefault,
EscapeUnicode,
FromStr,
Lines,
MatchIndices,
Matches,
ParseBoolError,
RMatchIndices,
RMatches,
RSplit,
RSplitN,
RSplitTerminator,
Split,
SplitAsciiWhitespace,
SplitN,
SplitTerminator,
SplitWhitespace,
Utf8Error,
};
impl<D: AllocRef> Borrow<str> for String<D> {
#[inline]
fn borrow(&self) -> &str {
&self[..]
}
}
impl<D: AllocRef> BorrowMut<str> for String<D> {
#[inline]
fn borrow_mut(&mut self) -> &mut str {
&mut self[..]
}
}
#[allow(clippy::missing_safety_doc)]
#[inline]
pub unsafe fn from_boxed_utf8_unchecked<A: AllocRef>(v: Box<[u8], A>) -> Box<str, A> {
let a = core::ptr::read(v.build_alloc());
Box::from_raw_in(Box::into_raw(v) as *mut str, a)
}