Skip to content

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

@therealbnut

Description

@therealbnut

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions