ToOwning

Trait ToOwning 

Source
pub trait ToOwning {
    type Owning;

    // Required method
    fn to_owning(&self) -> Self::Owning;
}
Expand description

A generalization of ToOwned.

ToOwning is weaker than ToOwned because there is no constraint of Owning : Borrow<Self> as there is on ToOwned::Owned. Thus, ToOwning represents a type which can be converted from a reference into a related type that owns its contents, but unlike ToOwned doesn’t necessarily let you get a reference to the original type back out.

ToOwning has a blanket implementation for T where T : ToOwned, wherein Owning = Owned and to_owning = to_owned. User-defined types which implement ToOwning but not ToOwned typically should do so by calling .to_owning() on all their fields.

Required Associated Types§

Source

type Owning

The resulting type after obtaining ownership of self’s contents.

Required Methods§

Source

fn to_owning(&self) -> Self::Owning

Creates an object which owns its contents from one which borrows them.

Implementors§

Source§

impl<'b, B> ToOwning for Borrowed<'b, B>
where B: ToOwning + ?Sized,

Source§

impl<B> ToOwning for Owned<B>
where B: ToOwning + ?Sized, B::Owning: Borrow<B>,

Source§

impl<B> ToOwning for B
where B: ToOwned + ?Sized,

Source§

impl<T> ToOwning for ChangeOrKeep<T>
where T: ToOwning, T::Owning: ToOwning<Owning = T::Owning>,

Source§

impl<T> ToOwning for Change<T>
where T: ToOwning,