bytemuck/derive
zachs18 a637e1d983
derive(Zeroable) on fieldful enums and repr(C) enums (#257)
* Add support for deriving Zeroable for fieldful enums if:

1. the enum is repr(Int), repr(C), or repr(C, Int),
2. the enum has a variant with discriminant 0,
3. and all fields of the variant with discriminant 0 are Zeroable.

* Allow using derive(Zeroable) with explicit bounds. Update documentation and doctests.

* doc update

* doc update

* remove unused

* Factor out get_zero_variant helper function.

* Use i128 to track disciminants instead of i64.

* Add doc-comment for `get_fields`

Co-authored-by: Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>

* Update derive/src/traits.rs

Co-authored-by: Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>

---------

Co-authored-by: Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>
2024-09-24 12:30:38 -06:00
..
src derive(Zeroable) on fieldful enums and repr(C) enums (#257) 2024-09-24 12:30:38 -06:00
tests derive(Zeroable) on fieldful enums and repr(C) enums (#257) 2024-09-24 12:30:38 -06:00
Cargo.toml chore: Release bytemuck_derive version 1.7.1 2024-08-16 00:40:22 -06:00
changelog.md derive changelog 2024-08-16 00:39:48 -06:00
LICENSE-APACHE Replace LICENCES-* symlinks with a licence copy. (#118) 2022-07-13 06:53:17 -06:00
LICENSE-MIT Replace LICENCES-* symlinks with a licence copy. (#118) 2022-07-13 06:53:17 -06:00
LICENSE-ZLIB Replace LICENCES-* symlinks with a licence copy. (#118) 2022-07-13 06:53:17 -06:00
README.md docs. 2023-09-05 15:06:36 -06:00

bytemuck_derive

Derive macros for bytemuck traits.

MSRV: None!

This is an opt-in bonus feature for bytemuck that doesn't particularly do anything you couldn't do yourself, and so MSRV is not a strong consideration for this crate.