Skip to main content

IntoStr

Trait IntoStr 

Source
pub trait IntoStr: Display {
    // Provided methods
    fn into_str(self) -> Str
       where Self: Sized { ... }
    fn into_str_mut(self) -> StrMut
       where Self: Sized { ... }
    fn to_str(&self) -> Str { ... }
    fn to_strmut(&self) -> StrMut { ... }
}
Expand description

Convert value to Str/StrMut using fmt::Display, potentially without allocating.

Almost identical to ToString, but converts to Str/StrMut instead.

Provided Methods§

Source

fn into_str(self) -> Str
where Self: Sized,

Convert value to Str.

Source

fn into_str_mut(self) -> StrMut
where Self: Sized,

Convert value to StrMut.

Source

fn to_str(&self) -> Str

Convert value to Str.

Source

fn to_strmut(&self) -> StrMut

Convert value to StrMut.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IntoStr for &mut str

Source§

impl IntoStr for &str

Source§

impl IntoStr for Arc<str>

Source§

impl IntoStr for Box<str>

Source§

impl IntoStr for Cow<'_, str>

Source§

impl IntoStr for Str

Source§

impl IntoStr for String

Source§

impl<T> IntoStr for &T
where T: Display + ?Sized,

Source§

default fn into_str(self) -> Str

Source§

default fn into_str_mut(self) -> StrMut

Source§

default fn to_str(&self) -> Str

Source§

default fn to_strmut(&self) -> StrMut

Implementors§

Source§

impl IntoStr for CowStr<'_>

Source§

impl IntoStr for omp_core::str::Str

Source§

impl IntoStr for StrMut