rustdoc allows you to document struct fields and enum variants by including a doc comment above each line:
enum Choices {
/// The first choice.
First,
/// The second choice.
Second,
}
struct Person {
/// The person's name.
name: String,
/// The person's age.
age: u8,
}
These will show up with nice formatting in the HTML generated by rustdoc. However, I haven't seen any way of making similar nicely-formatted documents for function arguments. Is there an "official" way to document them or do you just have to describe them freeform in the function's main documentation section?
PowerOfTwoOrPrime
newtype with an appropriate constructor. – Coextend