Expand description

Smart pointer owning its pointee and generalization of std::borrow::Cow

deref_owned provides a smart pointer Owned, which points to a value that can be borrowed from an owned inner value. It’s similar to Cow, except that it’s always owning a value.

Moreover, a trait GenericCow is provided, which allows conversion from certain pointers into an owned value though an .into_owned() method. The trait GenericCow is implemented for:

  • &'a B where B: ToOwned
  • Cow<'a, B> where B: ToOwned
  • Owned<'a, B, O> where O: Borrow<B>

Here

  • B: ?Sized is the borrowed type (and also the type of the pointer target) and
  • O: Borrow<B> is an owned type.

Structs

Smart pointer to value that can be borrowed from owned inner value

Traits

Pointer types that can be converted into an owned type