-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document attributes #17
Comments
Also, it would be good to show an example of documenting the generated struct. Placing doc comments above the |
This is documented with the phrase "The syntax of this macro is the syntax of a tuple struct, including attributes and documentation comments, " on https://docs.rs/bitfield/0.13.0/bitfield/macro.bitfield.html for the struct and as the first element of list following "A field declaration is composed of the following:" on https://docs.rs/bitfield/0.13.0/bitfield/macro.bitfield_fields.html for the fields. Do you think that adding that using that in the example would be enough to make it clear and discoverable ? (as a side note, documentation comments are transformed into an attribute by the rust compiler before they reach the macro. This means that if you have a macro that support arbitrary attributes, it also support documentation comments) |
The current documentation isn't very clear. I didn't realize that I could attach attributes until I had read the source. Examples would be very helpful. |
I've been using this crate for about a year now, and also only just realized I could add attributes. |
It looks like the
bitfield
macro supports placing pretty much any compiler attribute on the struct or on any field. This is very useful, especially for doing things like#[derive(Clone)]
. But it's not documented anywhere. Ideally it should be documented in the API docs and in the examples.The text was updated successfully, but these errors were encountered: