Faster, more compact implementation of std::borrow::Cow
Cow<str>
(#47), thanks to @Nilstrieb.Deserialize
implementation for beef::Cow<str>
using the impl_serde
feature is now specialized, and will produced a borrowed variant if possible, which is particularly useful for serde_json
(see #44).const_fn
feature is internally using a narrower unstable feature gate const_fn_trait_bound
(see #41).beef::lean::Cow
is two words wide on 64-bit architectures only.Sync
and Send
markers (#37, #38. #39).Unpin
impl (#39).Default
on Cow
(#32).PartialOrd
and Ord
, and fixed Eq
impls (#28, #29).const_str
and const_slice
are now available for both beef::Cow
and beef::lean::Cow
.const_str
no longer requires nightly and is available without a feature flag.unwrap_borrowed
method, thanks @Licenser (#20).beef::lean::Cow
, found thanks to Miri and @RalfJung.impl_serde
feature which provides a Serialize
and Deserialize
trait implementations.is_borrowed
and is_owned
methods.beef::Cow<'a, T>
is now a type alias to beef::generic::Cow<'a, T, Wide>
where Wide
is private. This doesn't change anything, merely hides Option<NonZeroUsize>
as implementation detail and makes errors more readable.const_fn
feature now adds two separate functions instead of one: const_str
and const_slice
for borrowing &'static str
and &'static [T]
respectively. This is the only breaking change this release.beef::Cow<'a, T>
is now a type alias for beef::generic::Cow<'a, T, Option<NonZeroUsize>>
.beef::lean::Cow<'a, T>
which is a type alias for beef::generic::Cow<'a, T, Lean>
, where Lean
is a 0-sized struct. This version of the Cow
stores length and capacity together on a single usize
, and is only available for 64-bit targets.const_fn
now adds Cow::const_borrowed
as a separate function. This is not available for beef::lean::Cow
.Beef
trait has been made private.owned_from_parts
.