-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
General rustdoc improvements #450
General rustdoc improvements #450
Conversation
I could use some high level guidance on this. In particular, where as promoting the newest tokio-threadpool crate documentation over the (now hidden, older) tokio::executor::thread_pool docs seems to add value (4076bea...992d4f7), resolving the apparent redundancy in places like with the reactor will require more effort:
Current links:
tokio-fs is in a slightly different state:
I suspect moving all the docs to the associated split-out crates with only links from the tokio crate would be best, and the sooner the better, as it would be less confusing to users in current versions, without any code changes. This can be done in advance of deprecating the re-exports in tokio, at least where they are not essential or proving difficult to maintain. To reiterate, the reason I've wandered down this particular rabbit hole is the desire to summarize on Thoughts on how to proceed? |
Thanks! Sorry for the delay. I have been out of town and am still catching up :) |
I don't think I have a great answer. The facade strategy means that crates can be used standalone by lib authors, and application authors just depend on The problem with documentation is that there are now two paths to get to docs depending on your use case. When looking at the sub crate doc, you need to be able to use the library standalone. When coming from the facade, you want to know how everything fits together. This is why the docs are a bit different. When documenting Because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some thoughts inline.
@@ -44,79 +44,10 @@ | |||
pub mod current_thread; | |||
|
|||
#[deprecated(since = "0.1.8", note = "use tokio-threadpool crate instead")] | |||
#[doc(hidden)] | |||
/// Re-exports of [`tokio-threadpool`], deprecated in favor of the crate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you clarify why you removed #[doc(hidden)]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed #[doc(hidden)]
so that the deprecation tag plus the short note and link I added to tokio-threadpool is visible. As of the last 0.1.7 release there was the full documentation here. Otherwise, on current master (without my change) the module just vanishes from the rustdoc, without even the deprecation tag being visible, which isn't super helpful to anyone currently using that path and wondering how to upgrade.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal is the deprecation message would provide the upgrade hint. The pattern in the past is to hide deprecated APIs from docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Irrespective of conventions, my change improves the rustdoc by showing the deprecation and a link. The deprecation note is still useful/visible when compiling something that uses this path. Also I removed the much larger doc-comment section that would show up without the doc(hidden)
, so that is also at parity.
If you feel strongly that deprecated re-exports must not be documented (I respectfully disagree), then I can put the #[doc(hidden)]
back and remove my new doc-comment and link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either way, it can be sorted later.
tokio-threadpool/src/lib.rs
Outdated
// thread is able to block. Once it finishes processing the blocking future, the | ||
// thread has no additional work and is inserted into the backup pool. This | ||
// makes it available to other workers that encounter a `blocking` call. | ||
//! A work-stealing based thread pool for executing futures. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This documentation was mostly intended for those who are exploring the source. Do you think it is useful to users of the library?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Most importantly, because this is the only place where the two types of threads (worker and backup) are described. These details are essential to gaining sufficient understanding of the blocking
strategy.
Toward making these docs more generally useful, maybe the ¶ Crate layout section could be renamed ¶ Implementation notes and moved to the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest that the three following sections stay as code comments as I don't see them providing any insight to users:
- Crate layout
- Sleeping workers
- Notifying workers
The other sections are probably fine to include in the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One point of potential clarification for backup threads. Is it correct to say that if there is a fully sleeping backup thread at the point where a new worker is needed (blocking
called on an existing worker thread), then sleeping backup can be promoted to a new worker? Or is that more a potential future optimization then a current one? It would also be fare if you told me that the rustdoc (-threadpool root) can omit that level of detail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I also stated below, I don't think this an essential clarification needed to merge this. Can improve that latter, with a more targetted/ less "general" PR.
pub mod thread_pool { | ||
//! Maintains a pool of threads across which the set of spawned tasks are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this doc can probably be moved to tokio-threadpool/src/lib.rs
as the crate leevele docs there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that some (but looking at specifics, not necessarily all) of the original remains useful and could be reused for tokio-threadpool. I will include that in update plan.
I was out of town for your reply, thanks. I'll reply to specific questions and guidance, and conclude by proposing a set of steps to move this forward. |
Regarding "two paths" and two use cases, would it be a reasonable goal for the tokio crate, façade rustdocs to become more overview ("how [things] fit together") with a link to the specific crate, where the lower-level details may be found? I won't go any further with this here, in this PR, but I will start making those adjustments for tokio-fs (in or after #454 is merged), if that is agreeable. Proposed plan to move this PR forward:
Sound reasonable? |
docs.rs is smart enough to show docs for the latest M.N.P release when M.N is used in the link. For example: https://docs.rs/mio/0.6/mio/struct.Poll.html ..will show mio 0.6.14 and later docs. While using the `M.N.*` (ASTERISK) syntax also works, `M.N` is the more common usage, so standarize a few existing links to that format.
Some of the previously hidden rustdoc, deleted in: 30e0034 Replace hidden tokio::executor::thread_pool docs with deprecation note ...is here reused in the tokio-threadpool crate root rustdoc.
...and general improvements and linking.
58498a8
to
311d7cc
Compare
I hope so! Rebased, and added the changes as planned. |
I'm hoping for feedback on this with us both back in town? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks,
I responded to your thoughts. Also, if you could avoid rebasing PRs after an initial review, that would be appreciated. Rebasing makes it harder to tell what exactly changed since last review.
I only rebased because there was a new conflict after the first two weeks, but I will defer to your preference in the future. There is no conflict now, so my (new updated, latest feedback) plan is to hide the three sections you indicate. Sound reasonable? |
Per review suggestion by @carllerche on tokio-rs#450, this essentially reverts the promotion of these low-level detail sections, as done originally in: 014229f Promote tokio-threadpool crate level comments to rustdoc github: cc tokio-rs#421
OK, that one point of potential clarification could be adding in another PR, in any case. How is this as of a0880e0 as far as merge acceptability then? |
Resolved conflicts by a merge from master, instead of rebase, with ad04b61. |
All checks pass @carllerche. Are we good here? |
Hey @carllerche I thought we were pretty close to resolving this one. Have I done something to offend or done something wrong with the github review UI? |
@carllerche, was there something more I was supposed to do on my end with this? Otherwise, can it be merged? I have runtime docs on my TODO list but at lower priority, I hope you understand, if I can't get this merged. |
No =) The PR seems good to me but you have to rebase on master to fix conflicts. |
OK, merged again. |
Sorry for the delay (have a new baby). I'll try to take a look asap. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Great, thanks (and congrats!) |
Listed as dependency of #437. |
I started this general branch of rustdoc improvements as part of the effort to document for #339. A description of blocking in the runtime module warrants a summary of the feature and links to greater detail. In particular, 014229f promotes your (@carllerche) recent documentation of tokio-threadpool to rustdoc so I can reference it.