Expand description

Generalization of std::borrow::Cow

deref_owned provides a wrapper Owned which holds an inner value and points to it by implementing Deref. Owned is similar to Cow, except that it’s always owning a value. This can be used to avoid runtime overhead in certain scenarios.

Moreover, a trait GenericCow<B: ?Sized + ToOwned>: Borrow<B> is provided, which allows conversion from certain types into an owned type <B as ToOwned>::Owned through an .into_owned() method. The trait can be seen as a generalization of Cow<'_, B> and is implemented for:

  • &'a B
  • Cow<'a, B>
  • Owned<<B as ToOwned>::Owned>

Structs

Wrapper holding an owned value of type T and implementing Deref<Target = T>

Traits

Types which implement Borrow<B> and can be converted into <B as ToOwned>::Owned