I'm making a library in Rust and I've started writing documentation for it. I notice that on e.g. https://doc.rust-lang.org/std/primitive.u128.html, the values of constants such as u128::BITS
are hidden, and only pub const BITS: u32
is displayed. However, when I run cargo doc
on my computer for my library, the documentation page shows the values of all associated constants for a struct that I have defined.
There are other similar constants which use several lines of code to compute and so look quite ugly like this one. How can I change this so that the value of each constant is hidden?
I have now published this library and in the documentation on docs.rs this issue is no longer present, with the values of associated constants being hidden and an underscore displayed instead. So it only appears to be an issue when building documentation locally.
I'm not sure if this is a bug in rustdoc
when running locally, or whether it is intentional to display the values of constants in development but hide them in production. However, because obviously the appearance of local documentation isn't so important, this is not really a problem anymore.