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

docs(iroh): Enable iroh_docsrs feature #2780

Merged
merged 4 commits into from
Oct 15, 2024
Merged

docs(iroh): Enable iroh_docsrs feature #2780

merged 4 commits into from
Oct 15, 2024

Conversation

flub
Copy link
Contributor

@flub flub commented Oct 3, 2024

Description

This uses the same iroh_docsrs cfg as the other crates and updates the
preview CI job to also use this.

Breaking Changes

None

Notes & open questions

However, the world is a sad place.

As far as I can figure out this all correctly annotates the features in our docs in the individual crates. That is, https://docs.rs/iroh-net and https://docs.rs/iroh-gossip etc. This is also true for the iroh crate. BUT, the iroh crate uses doc(inline) on the other crates, and when using this we can not get the feature annotation in the sub-crates. Sad times.

Change checklist

  • Self-review.
  • [ ] Documentation updates following the style guide, if relevant.
  • [ ] Tests if relevant.
  • [ ] All breaking changes documented.

This uses the same iroh_docsrs cfg as the other crates and updates the
preview CI job to also use this.  Now we get the features documented
everywhere and get to see it in the preview.
@flub flub requested a review from matheus23 October 3, 2024 10:48
Copy link

github-actions bot commented Oct 3, 2024

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/2780/docs/iroh/

Last updated: 2024-10-04T14:51:47Z

@flub flub marked this pull request as draft October 3, 2024 10:58
Copy link

github-actions bot commented Oct 3, 2024

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: ff93420

@flub
Copy link
Contributor Author

flub commented Oct 3, 2024

Somehow this doesn't work yet, the features show up for the iroh crate --e.g. iroh::metrics-- but not for for e.g. iroh::net::relay. I don't want to waste time on this right now because this drove me crazy last time I was working on this. I'll try again on a docs Friday.

@flub flub marked this pull request as ready for review October 4, 2024 14:57
Copy link
Contributor

@matheus23 matheus23 left a comment

Choose a reason for hiding this comment

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

Did you try using doc(auto_cfg) @flub?

There's little material about it online, but essentially it boils down to

  1. Use !#[doc(auto_cfg)] in your lib.rs, then
  2. all #[cfg(...)]s are picked up automagically.

You can see an example of this in ed25519-dalek source code.
And how it renders.

@flub
Copy link
Contributor Author

flub commented Oct 15, 2024

I swear I tried this and failed, while doing it manually did work. Maybe its worth trying this again now that at least the basics are working. I'm tempted to kick this to an other PR though and would rather merge this as working.

@flub flub added this pull request to the merge queue Oct 15, 2024
Merged via the queue into main with commit 234a856 Oct 15, 2024
28 checks passed
@flub flub deleted the flub/docs-features-iroh branch October 15, 2024 10:40
matheus23 pushed a commit that referenced this pull request Nov 14, 2024
## Description

This uses the same iroh_docsrs cfg as the other crates and updates the
preview CI job to also use this.

## Breaking Changes

None

## Notes & open questions

However, the world is a sad place.

As far as I can figure out this all correctly annotates the features in
our docs in the individual crates. That is, `https://docs.rs/iroh-net`
and `https://docs.rs/iroh-gossip` etc. This is also true for the `iroh`
crate. BUT, the iroh crate uses `doc(inline)` on the other crates, and
when using this we can not get the feature annotation in the sub-crates.
Sad times.

## Change checklist

- [x] Self-review.
- ~~[ ] Documentation updates following the [style
guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text),
if relevant.~~
- ~~[ ] Tests if relevant.~~
- ~~[ ] All breaking changes documented.~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants