hashmismatch / packed_struct.rs

Bit-level packing and unpacking for Rust
MIT License
163 stars 30 forks source link

Add a simple nested struct example into the readme #73

Closed rhn closed 3 years ago

rhn commented 3 years ago

The change from "struct" to "field" confused me in https://github.com/hashmismatch/packed_struct.rs/issues/72, so I'm adding an example to help future readers.

rudib commented 3 years ago

Thanks for the contribution!

The documentation is actually built from the library itself, and the included samples are doc tests. You should write your sample above https://github.com/hashmismatch/packed_struct.rs/blob/51f779d923c48eed1b321d46181c5ef848fd05a0/packed_struct/src/lib.rs#L197-L202 and then generate README.md using cargo readme.

rhn commented 3 years ago

Given that https://github.com/hashmismatch/packed_struct.rs/pull/74 addresses the same issue, I'm no longer motivated to ad this to the readme ;) I could add a test for the codegen to make sure the message is displayed when it should, but I'm not sure how to create such a test.