iliekturtles / uom

Units of measurement -- type-safe zero-cost dimensional analysis
Apache License 2.0
1.01k stars 92 forks source link

Improve `const` generated docs #426

Open DJDuque opened 1 year ago

DJDuque commented 1 year ago

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.

iliekturtles commented 1 year ago

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.