Can rustdoc show constant values for non-primitive types

is there's a config or command line flag I can set to make rustdoc show the values of non-primitive constants? I can't find one from the manual.

it's common to define (associated) constants for (transparent) wrapper types, e.g. the crate bitflags uses this approach, but the generated documents don't show the actual value of the constant definition, they only show constant values for primitive type.

for example, the document of the bitflags example is generated with an "underscore" placeholder. (although in this particular case, the example does have a doc string showing what the bit pattern is defined)

another example, here's a comparison for the same constant definition from the crates windows-sys and windows, because windows-sys uses a type alias, the document gets generated with concrete value, while windows uses wrapper new type, the document doesn't show the actual value of the constant.

some context: I was analyzing some binary file format with the help of a hex editor and a rust crate, and I need to learn the meaning of the hex values. it would be really helpful if I can use the browser to navigate through the rendered document, as it's easier than reading the source code directly (the docs are rendered as "comments" in the code editor, and they contain many markdown noises)

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.