bytes
bytes copied to clipboard
Removing From<Vec<u8>> and From<ByteBuf> was mistake
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.
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.