bytes icon indicating copy to clipboard operation
bytes copied to clipboard

Removing From<Vec<u8>> and From<ByteBuf> was mistake

Open misos1 opened this issue 5 years ago • 1 comments

https://github.com/serde-rs/bytes/commit/f8c4812d1e81f4bb7813fa25c37b52dc3e065741 https://github.com/serde-rs/bytes/commit/f810459d2af103184767050e6181846ed9e12138 https://github.com/serde-rs/bytes/issues/3

They could coexists with ByteBuf::from and ByteBuf::into_vec if you think these functions are clearer in documentation. I never had problems with looking for From trait implementations.

Now is not possible to use it with generic functions which uses things like T: From<Vec<u8>>. There is reason why there are traits like From trait in rust.

And solution to problems like this https://github.com/serde-rs/bytes/issues/14 require even more extra glue code as before.

misos1 avatar Jul 12 '19 16:07 misos1

Would a PR to re-add From<Vec<u8>> and From<ByteBuf> be accepted? I have run into the exact case mentioned above where I need ByteBuf to implement the From<Vec<u8>> because it is used as a type parameter to another trait with that constraint.

nathanielc avatar Feb 13 '23 22:02 nathanielc