Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capture_docs attribute #118

Merged
merged 14 commits into from
Jul 28, 2021
Merged

Add capture_docs attribute #118

merged 14 commits into from
Jul 28, 2021

Conversation

ascjones
Copy link
Contributor

@ascjones ascjones commented Jul 23, 2021

Annotating a type with #[scale_info(capture_docs = "always|never|default")] will override the default docs capturing enabled by the docs feature.

#[scale_info(capture_docs = "never")]

Never capture docs for a specific type even if the docs feature is enabled.

#[scale_info(capture_docs = "always")]

Always capture docs for a specific type even if the docs feature is not enabled.

#[scale_info(capture_docs = "default")]

Captures docs iff the docs feature is enabled, which is the default if this attribute is not present

This will allow e.g. including required docs for enums such as Call, Error etc in substrate pallets without adding docs for every single other type, thus bloating the runtime size.

Derive refactoring

Much of the changes in the diff are because of the TypeInfoImpl type I have introduced into the derive implementation, which allows sharing of the attributes and other state to avoid it having to be passed around through all the methods. We could do some further refactoring here but this is a good first step.

@ascjones ascjones marked this pull request as ready for review July 26, 2021 14:53
@ascjones ascjones merged commit 08fc6d4 into master Jul 28, 2021
@ascjones ascjones deleted the aj-capture-docs-attr branch July 28, 2021 10:24
@ascjones ascjones mentioned this pull request Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant