Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Allow SmartString to work as the Owned type in Cow #39

Open
therealbnut opened this issue Feb 13, 2023 · 0 comments
Open

Comments

@therealbnut
Copy link

Hi,

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant