Trait static_cow::ToOwning
source · 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.
ToOwning's lifetime parameter 'o is the lifetime of the owning type.
In most circumstances this can be 'static. This is only not the case if
you have a ToOwning implementation that takes ownership of only some of
its contents, while others continue to have constrained lifetime.