Idea: `AsBytes` convenience macro and trait for `IntoBytes + Immutable`
Open
- Dominant language
- Rust
- Stars
- 2.6k
- Forks
- 179
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 29
Description
It would be ergonomic to have an `AsBytes` derive macro to derive both `IntoBytes` and `Immutable`, as well as a convenience blanket-implemented trait `AsBytes` for all `T: ?Sized + Immutable + IntoBytes`. This would [not be](https://docs.rs/zerocopy/latest/zerocopy/byte_slice/trait.ByteSliceMut.html#impl-ByteSliceMut-for-B) the first blanket-implemented trait in zerocopy 0.8.
This'd shorten the common `#[derive(FromBytes, IntoBytes, Immutable)]` and `T: Immutable + IntoBytes` into `#[derive(AsBytes, FromBytes)]` and `T: AsBytes`.
It'd also help migrations from 0.7 to some degree, even if the details of the names are changing.
Contributor guide
Assessment
This issue has not been assessed yet.