You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it'd be great to allow SmartString to work better with Cow. It's great how SmartString already saves memory when the value is owned, but the best you can do with Cow is allow it to be converted to String on write. This all should be possible if there was a SmartStr newtype around str, and SmartStr::Owned = SmartString.
The requirement of implementing Borrow on SmartString means this must be implemented in this crate. The implementation could start with the newtype struct SmartStr(str);, and mostly use safe rust. The only unsafe part may be a transmute for the borrow implementations.
Thanks!
The text was updated successfully, but these errors were encountered:
Hi,
I think it'd be great to allow
SmartString
to work better withCow
. It's great howSmartString
already saves memory when the value is owned, but the best you can do withCow
is allow it to be converted toString
on write. This all should be possible if there was aSmartStr
newtype aroundstr
, andSmartStr::Owned = SmartString
.The requirement of implementing
Borrow
onSmartString
means this must be implemented in this crate. The implementation could start with the newtypestruct SmartStr(str);
, and mostly use safe rust. The only unsafe part may be a transmute for theborrow
implementations.Thanks!
The text was updated successfully, but these errors were encountered: