@@ -12,7 +12,7 @@ As this library provides a procedural macro, it has no runtime dependencies and
12
12
- Compile-time checks for type and field sizes
13
13
- Rust-analyzer/docrs friendly (carries over docs to accessor functions)
14
14
- Exports field offsets and sizes as constants (useful for const asserts)
15
- - Generation of ` Default ` , ` fmt:: Debug` , or ` defmt::Format ` traits
15
+ - Optional generation of ` Default ` , ` Clone ` , ` Debug ` , ` Hash ` , or ` defmt::Format ` traits
16
16
- Custom internal representation (endianness)
17
17
18
18
## Usage
@@ -435,9 +435,23 @@ struct DefmtExample {
435
435
}
436
436
```
437
437
438
- ### Conditionally Enable ` new ` / ` Clone ` / ` Debug ` / ` Default ` / ` defmt::Format `
438
+ ### Support for ` std::hash::Hash `
439
439
440
- Instead of booleans, you can specify ` cfg(...) ` attributes for ` new ` , ` clone ` , ` debug ` , ` default ` and ` defmt ` :
440
+ This macro can also implement ` Hash ` , which ignores any padding when hashing.
441
+
442
+ ``` rust
443
+ use bitfield_struct :: bitfield;
444
+
445
+ #[bitfield(u64 , hash = true)]
446
+ struct HashExample {
447
+ __ignored : u32 ,
448
+ data : u32 ,
449
+ }
450
+ ```
451
+
452
+ ### Conditionally Enable ` new ` /` Clone ` /` Debug ` /` Default ` /` defmt::Format ` /` Hash `
453
+
454
+ Instead of booleans, you can specify ` cfg(...) ` attributes for ` new ` , ` clone ` , ` debug ` , ` default ` , ` defmt ` and ` hash ` :
441
455
442
456
``` rust
443
457
use bitfield_struct :: bitfield;
0 commit comments