Lokathor / bytemuck

A crate for mucking around with piles of bytes
https://docs.rs/bytemuck
Apache License 2.0
697 stars 77 forks source link

Convert `BoxBytes` to/from boxed slices #228

Closed zachs18 closed 6 months ago

zachs18 commented 6 months ago

As I mentioned in a comment on the BoxBytes PR, BoxBytes logically can be converted to/from boxed slices as well as boxed Sized types. This PR extends the existing box_bytes_of/(try_)from_box_bytes using sealed traits to allow them to take/return boxed slices as well as their current boxed Sized types (and Box<str> for box_bytes_of).

semver The relaxation of the function bounds is not a breaking change. The change from `impl From> for BoxBytes` to `impl From> for BoxBytes` I believe is not a breaking change: * Any type for which a downstream crate was previously allowed to implement `From> for BoxBytes` must have `U` as a local, non-`NoUninit` type, which as far as I can tell is still allowed under this new impl.
Lokathor commented 6 months ago

Released bytemuck-1.15.0

Please report any compatibility problems that somehow appear.