bytemuck/derive/tests
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
..
basic.rs derive(Zeroable) on fieldful enums and repr(C) enums (#257) 2024-09-24 12:30:38 -06:00