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

fix: generate docs behind features #741

Merged
merged 2 commits into from
May 6, 2022
Merged

Conversation

niklasad1
Copy link
Member

Closing #668

@niklasad1 niklasad1 requested a review from a team as a code owner April 27, 2022 14:08
Copy link
Member

@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, its nice and cleaner

jsonrpsee-types = { path = "../types", version = "0.11.0", package = "jsonrpsee-types", optional = true }
jsonrpsee-http-client = { path = "../client/http-client", version = "0.11.0", optional = true }
jsonrpsee-ws-client = { path = "../client/ws-client", version = "0.11.0", optional = true }
jsonrpsee-wasm-client = { path = "../client/wasm-client", version = "0.11.0", optional = true }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note added jsonrpsee-wasm-client here

Comment on lines 89 to 97
macro_rules! cfg_proc_macros {
($($item:item)*) => {
$(
#[cfg(feature = "jsonrpsee-proc-macros")]
#[cfg_attr(docsrs, doc(cfg(feature = "jsonrpsee-proc-macros")))]
$item
)*
}
}
Copy link
Collaborator

@jsdw jsdw May 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to write a macro like:

macro_rules! cfg_feature {
    ($feature:literal, $($item:item)*) => {
        $(
            #[cfg(feature = $feature)]
            #[cfg_attr(docsrs, doc(cfg(feature = $feature)))]
            $item
        )*
    }
}

And then most of the other macros across these crates can just call that internally like:

macro_rules! cfg_proc_macros {
    ($($item:item)*) => cfg_feature!("jsonrpc-proc-macros", $($item:item)*)
}

There seem like enough copies to justify it :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I agree

Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one suggestion to reduce the macro repetition

@niklasad1 niklasad1 merged commit f28f860 into master May 6, 2022
@niklasad1 niklasad1 deleted the docs-for-optional-features branch May 6, 2022 09:43
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.

5 participants