iliekturtles / uom

Units of measurement -- type-safe zero-cost dimensional analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve `const` generated docs

DJDuque opened this issue · comments

I am not sure if this is even possible at the library level. If it is not, feel free to close this issue.

Issue

If you are writing a library and you have something like:

pub const MY_LENGTH: f64 = 1.0 * 5.0

this will generate documentation using cargo doc like:

pub const MY_LENGTH: f64= _; // 5f64

If you are using uom to have a constant length like:

pub const MY_LENGTH: Length = Length {
    dimension: PhantomData,
    units: PhantomData,
    value: 5.0,
};

this will generate documentation like:

pub const MY_LENGTH: Length;

Suggestion

It would be great if the generated doc had an extra comment line to show what the numeric value of the constant is. Something like:

pub const MY_LENGTH: Length; // 5f64 meters

Or anything along those lines.

Are you referring to output generated by cargo doc? If so that's not something a library can control and you'd need to look into reporting the issue there.