string icon indicating copy to clipboard operation
string copied to clipboard

Implement From<&str> and From<String> for String<Bytes>?

Open nerdrew opened this issue 6 years ago • 1 comments

From<&str> and From<String> are only implemented for String<&str> and String<String>. I suppose you can't implement them for generic storage... is there even a trait that makes sense for generic byte storage?

Thoughts on implementing From<&str> and From<String> for String<Bytes>? I'm trying to add a crate feature to enable Bytes storage for quick-protobuf and I'd like to have the tests be generic over the byte storage feature. It seems like "boom".into() is a good fit for Cow::Borrowed("boom") and String::from_str("boom").

nerdrew avatar Feb 17 '19 21:02 nerdrew

I'm not sure off the top of my head, but there may be some coherence problems? Why don't you see if you can add those conversions.

carllerche avatar Feb 19 '19 17:02 carllerche