bytemuck/tests
Christopher Serr 7311e9b4b8
Implement ByteEq and ByteHash derives (#144)
* Implement `ByteEq` and `ByteHash` derives

This adds the derives `ByteEq` and `ByteHash` that can be used as an
alternative to the `Eq` / `PartialEq` and `Hash` derives from the
standard library. The difference is that these variants use `bytemuck`
to convert their values to byte slices before comparing / hashing them.
This allows the comparisons to turn into a simple `memcmp` / `bcmp` (or
completely inlined as a few vector instructions) and allows hashers to
process all bytes at once, possibly allowing for some vector operations
as well.

Here's a quick comparison of the generated assembly:
![https://i.imgur.com/CGTSWTZ.png](https://i.imgur.com/CGTSWTZ.png)

* Address review comments
2022-11-17 13:13:24 -07:00
..
array_tests.rs Attach min_const_generics to a crate feature (#63) 2021-06-05 08:25:57 -06:00
cast_slice_tests.rs [Feature] extend TransparentWrapper conversion functions (#58) 2021-03-28 23:11:13 -06:00
derive.rs Implement ByteEq and ByteHash derives (#144) 2022-11-17 13:13:24 -07:00
doc_tests.rs Duplicate the doctests for the sake of miri 2020-01-11 08:01:58 -08:00
offset_of_tests.rs update offset_of to have 2-arg and 3-arg versions. 2020-07-23 20:21:09 -06:00
std_tests.rs Prevent try_zeroed_box<T>() from reserving size_of<T>() space on the stack. (#43) 2020-10-21 14:11:09 -06:00
transparent.rs Conditionally compile in Arc (#140) 2022-11-05 07:00:40 -06:00
wrapper_forgets.rs Replace unsound usage of transmute_copy (#72) 2021-07-22 23:12:56 -06:00