ToOwned

Trait ToOwned 

Source
pub trait ToOwned: Sized {
    type Owned;

    // Required method
    fn to_owned(&self) -> Self::Owned;

    // Provided method
    fn into_owned(self) -> Self::Owned { ... }
}
Expand description

Convert from a borrowed type into an owned type.

This is similar to std::borrow::ToOwned but is meant for types with internal references, with support for into_owned and an additional Sized constraint.

Required Associated Types§

Source

type Owned

Owned type.

Required Methods§

Source

fn to_owned(&self) -> Self::Owned

Create an owned version of this type by cloning if necessary.

Provided Methods§

Source

fn into_owned(self) -> Self::Owned

Create an owned version of this type, consuming self.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ToOwned for &str

Source§

type Owned = String

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for bool

Source§

type Owned = bool

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for char

Source§

type Owned = char

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for f32

Source§

type Owned = f32

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for f64

Source§

type Owned = f64

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for i8

Source§

type Owned = i8

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for i16

Source§

type Owned = i16

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for i32

Source§

type Owned = i32

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for i64

Source§

type Owned = i64

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for i128

Source§

type Owned = i128

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for isize

Source§

type Owned = isize

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for u8

Source§

type Owned = u8

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for u16

Source§

type Owned = u16

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for u32

Source§

type Owned = u32

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for u64

Source§

type Owned = u64

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for u128

Source§

type Owned = u128

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for ()

Source§

type Owned = ()

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for usize

Source§

type Owned = usize

Source§

fn to_owned(&self) -> Self::Owned

Source§

impl ToOwned for String

Source§

type Owned = String

Source§

fn to_owned(&self) -> Self::Owned

Source§

fn into_owned(self) -> Self::Owned

Source§

impl<T> ToOwned for Cow<'_, T>
where T: ToOwned + 'static, T::Owned: Clone,

Source§

type Owned = Cow<'static, T>

Source§

fn to_owned(&self) -> Cow<'static, T>

Source§

fn into_owned(self) -> Cow<'static, T>

Implementors§

Source§

impl<'a, T> ToOwned for borrow_framework::Cow<'a, T>
where T: Cowable, CowableBorrowed<'a, T>: ToOwned<Owned = CowableOwned<T>>, CowableOwned<T>: Clone,

Source§

type Owned = Cow<'static, T>