use crate::Str;
#[cfg(feature = "alloc")]
use crate::{Arc, Box, Rc};
crate::_use! {basic::from_utf8}
trait Sealed {}
impl Sealed for str {}
#[doc = crate::_tags!(text)]
#[cfg_attr(nightly_doc, doc(notable_trait))]
#[expect(private_bounds, reason = "Sealed")]
pub trait StrExt: Sealed {
#[cfg(feature = "alloc")]
fn to_box(&self) -> Box<str>;
#[cfg(feature = "alloc")]
fn to_rc(&self) -> Rc<str>;
#[cfg(feature = "alloc")]
fn to_arc(&self) -> Arc<str>;
#[must_use]
fn repeat_into<'input, const CAP: usize>(
&self,
n: usize,
buffer: &'input mut [u8; CAP],
) -> &'input str;
fn repeat_into_slice<'input, const CAP: usize>(
&self,
n: usize,
buffer: &'input mut [u8],
) -> &'input str;
#[must_use]
fn new_counter(buffer: &mut [u8], length: usize, separator: char) -> &str;
}
impl StrExt for str {
#[cfg(feature = "alloc")]
fn to_box(&self) -> Box<str> {
Box::from(self)
}
#[cfg(feature = "alloc")]
fn to_rc(&self) -> Rc<str> {
Rc::from(self)
}
#[cfg(feature = "alloc")]
fn to_arc(&self) -> Arc<str> {
Arc::from(self)
}
fn repeat_into<'input, const CAP: usize>(
&self,
n: usize,
buffer: &'input mut [u8; CAP],
) -> &'input str {
Str::repeat_into(self, n, buffer)
}
fn repeat_into_slice<'input, const CAP: usize>(
&self,
n: usize,
buffer: &'input mut [u8],
) -> &'input str {
Str::repeat_into_slice(self, n, buffer)
}
fn new_counter(buffer: &mut [u8], length: usize, separator: char) -> &str {
Str::new_counter(buffer, length, separator)
}
}