Struct's field's documentation inheritance from the referred type

It would be nice to have something like a #[derive()] option that makes a struct's field inherit the documentation from the type it refers to.

1 Like

This would be #[doc(inherit)], which functions for top-level items but probably not fields.

For fields, you probably only want to inherit the short doc (first paragraph), not the full documentation, though.

Do you also want this in the generated documentation? It seems like for an IDE usecase at least it could likely implicitly do this without any source changes.

I want to be able to use something like "#[derive(field_doc)]" on a struct so that when its fields are not documented then they would inherit the documentation of the type they refer to, and that the inherited documentation would appear in the html documentation of the code.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.