Generate documentation for static methods
Closed this issue · 3 comments
tuguzT commented
I think it would be nice to generate documentation for impl block and for static methods which are generated by Constructor
, IsVariant
and Unwrap
derive macros.
For example, something like this:
#[derive(IsVariant)]
enum Maybe<T> {
Just(T),
Nothing
}
Generates this:
/// Check if [`Maybe`] is a value of some variant.
impl<T> Maybe<T> {
/// Returns `true` if [`Maybe`] is a [`Just`](Maybe::Just) value.
pub fn is_just(&self) -> bool {
match self {Self::Just(..) => true, _ => false}
}
/// Returns `true` if [`Maybe`] is a [`Nothing`](Maybe::Nothing) value.
pub fn is_nothing(&self) -> bool {
match self {Self::Nothing => true, _ => false}
}
}
This will be helpful for crates which use documentation lints, such as #![warn(missing_docs)]
.
phip1611 commented
This will be helpful for crates which use documentation lints, such as
What if the derived code uses #[automatically_derived]
? I thought that linters would then skip such code
tuguzT commented
Never heard about this attribute before 🤔.
If it works not only for trait implementations, this can be a solution to the problem.