[−][src]Trait beef::Beef
Helper trait required by Cow<T>
to extract capacity of owned
variant of T
, and manage conversions.
This can be only implemented on types that match requirements:
T::Owned
has acapacity
, which is an extra word that is absent inT
.T::Owned
withcapacity
of0
does not allocate memory.T::Owned
can be reconstructed from*mut T
borrowed out of it, plus capacity.
Required methods
fn owned_into_parts(owned: Self::Owned) -> (NonNull<Self>, Option<NonZeroUsize>)
Convert T::Owned
to NonNull<T>
and capacity.
Return None
for 0
capacity.
unsafe fn owned_from_parts(
ptr: NonNull<Self>,
capacity: NonZeroUsize
) -> Self::Owned
ptr: NonNull<Self>,
capacity: NonZeroUsize
) -> Self::Owned
Rebuild T::Owned
from NonNull<T>
and capacity
. This can be done by the likes
of Vec::from_raw_parts
.