-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[Doc] improve thread::Thread
and thread::Builder
documentations
#41814
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
Conversation
- Copied the module documentation to `Thread`. - Removed the example because it did not use any method of Thread.
(rust_highfive has picked a reviewer for you, use r? to override) |
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.
some small details! thank you!
src/libstd/thread/mod.rs
Outdated
@@ -244,6 +244,11 @@ impl Builder { | |||
/// Generates the base configuration for spawning a thread, from which | |||
/// configuration methods can be chained. | |||
/// | |||
/// If the [`stack_size`][stack_size] field is not specified, the stack size |
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.
changing this to just have
[`stack_size`]
would follow convention
src/libstd/thread/mod.rs
Outdated
@@ -259,6 +264,8 @@ impl Builder { | |||
/// | |||
/// handler.join().unwrap(); | |||
/// ``` | |||
/// | |||
/// [stack_size]: ../../std/thread/struct.Builder.html#method.stack_size |
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.
that means writing
[`stack_size`]: ../../std/
here
src/libstd/thread/mod.rs
Outdated
@@ -714,33 +721,21 @@ struct Inner { | |||
|
|||
#[derive(Clone)] | |||
#[stable(feature = "rust1", since = "1.0.0")] | |||
/// A handle to a thread. | |||
/// Threads are represented via the `Thread` type, which you can get in one of | |||
/// two ways: |
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 first line needs to be a summary; this doesn't quite work. I think leaving the first line, adding a ///
in between, and keeping this new stuff is 👍
Done :) |
@bors: r+ rollup thanks a ton! |
📌 Commit 323a774 has been approved by |
[Doc] improve `thread::Thread` and `thread::Builder` documentations Part of #29378 - Adds information about the stack_size when using `Builder`. This might be considered too low level, but I assume that if someone wants to create their own builder instead of using `thread::spawn` they may be interested in that info. - Updates the `thread::Thread` structure doc, mostly by explaining how to get one, the previous example was removed because it was not related to `thread::Thread`, but rather to `thread::Builder::name`. Not much is present there, mostly because this API is not often used (the only method that seems useful is `unpark`, which is documented in #41809).
☀️ Test successful - status-appveyor, status-travis |
Part of #29378
Builder
. This might be considered too low level, but I assume that if someone wants to create their own builder instead of usingthread::spawn
they may be interested in that info.thread::Thread
structure doc, mostly by explaining how to get one, the previous example was removed because it was not related tothread::Thread
, but rather tothread::Builder::name
.Not much is present there, mostly because this API is not often used (the only method that seems useful is
unpark
, which is documented in [DOC] Improve the thread::park and thread::unpark documentation #41809).