mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
doc: misc API documentation fixes (#1834)
This commit is contained in:
parent
dc356a4158
commit
942feab040
@ -91,7 +91,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
```
|
||||
|
||||
More examples can be found [here](examples). Note that the `master` branch
|
||||
is currently being updated to use `async` / `await`. The examples are
|
||||
is currently being updated to use `async` / `await`. The examples are
|
||||
not fully ported. Examples for stable Tokio can be found
|
||||
[here](https://github.com/tokio-rs/tokio/tree/v0.1.x/tokio/examples).
|
||||
|
||||
@ -101,7 +101,7 @@ not fully ported. Examples for stable Tokio can be found
|
||||
First, see if the answer to your question can be found in the [Guides] or the
|
||||
[API documentation]. If the answer is not there, there is an active community in
|
||||
the [Tokio Discord server][chat]. We would be happy to try to answer your
|
||||
question. Last, if that doesn't work, try opening an [issue] with the question.
|
||||
question. Last, if that doesn't work, try opening an [issue] with the question.
|
||||
|
||||
[Guides]: https://tokio.rs/docs/
|
||||
[API documentation]: https://docs.rs/tokio/latest/tokio
|
||||
|
@ -38,7 +38,7 @@ pub trait Decoder {
|
||||
/// Attempts to decode a frame from the provided buffer of bytes.
|
||||
///
|
||||
/// This method is called by `FramedRead` whenever bytes are ready to be
|
||||
/// parsed. The provided buffer of bytes is what's been read so far, and
|
||||
/// parsed. The provided buffer of bytes is what's been read so far, and
|
||||
/// this instance of `Decode` can determine whether an entire frame is in
|
||||
/// the buffer and is ready to be returned.
|
||||
///
|
||||
|
@ -101,7 +101,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
```
|
||||
|
||||
More examples can be found [here](../examples). Note that the `master` branch
|
||||
is currently being updated to use `async` / `await`. The examples are
|
||||
is currently being updated to use `async` / `await`. The examples are
|
||||
not fully ported. Examples for stable Tokio can be found
|
||||
[here](https://github.com/tokio-rs/tokio/tree/v0.1.x/tokio/examples).
|
||||
|
||||
@ -111,7 +111,7 @@ not fully ported. Examples for stable Tokio can be found
|
||||
First, see if the answer to your question can be found in the [Guides] or the
|
||||
[API documentation]. If the answer is not there, there is an active community in
|
||||
the [Tokio Discord server][chat]. We would be happy to try to answer your
|
||||
question. Last, if that doesn't work, try opening an [issue] with the question.
|
||||
question. Last, if that doesn't work, try opening an [issue] with the question.
|
||||
|
||||
[Guides]: https://tokio.rs/docs/
|
||||
[API documentation]: https://docs.rs/tokio/0.2
|
||||
|
@ -18,7 +18,7 @@
|
||||
//! Where possible, users should prefer the provided asynchronous-specific
|
||||
//! traits such as [`AsyncRead`], or methods returning a `Future` or `Poll`
|
||||
//! type. Adaptions also extend to traits like `std::io::Read` where methods
|
||||
//! return `std::io::Result`. Be warned that these adapted methods may return
|
||||
//! return `std::io::Result`. Be warned that these adapted methods may return
|
||||
//! `std::io::ErrorKind::WouldBlock` if a *worker* thread can not be converted
|
||||
//! to a *backup* thread immediately.
|
||||
//!
|
||||
|
@ -27,7 +27,7 @@ cfg_io_driver! {
|
||||
/// **Note**: While `PollEvented` is `Sync` (if the underlying I/O type is
|
||||
/// `Sync`), the caller must ensure that there are at most two tasks that
|
||||
/// use a `PollEvented` instance concurrently. One for reading and one for
|
||||
/// writing. While violating this requirement is "safe" from a Rust memory
|
||||
/// writing. While violating this requirement is "safe" from a Rust memory
|
||||
/// model point of view, it will result in unexpected behavior in the form
|
||||
/// of lost notifications and tasks hanging.
|
||||
///
|
||||
|
@ -30,7 +30,7 @@ cfg_io_driver! {
|
||||
/// ## Platform-specific events
|
||||
///
|
||||
/// `Registration` also allows receiving platform-specific `mio::Ready`
|
||||
/// events. These events are included as part of the read readiness event
|
||||
/// events. These events are included as part of the read readiness event
|
||||
/// stream. The write readiness event stream is only for `Ready::writable()`
|
||||
/// events.
|
||||
///
|
||||
|
@ -161,7 +161,7 @@ cfg_io_util! {
|
||||
///
|
||||
/// If the operation encounters an "end of file" before completely
|
||||
/// filling the buffer, it returns an error of the kind
|
||||
/// [`ErrorKind::UnexpectedEof`]. The contents of `buf` are unspecified
|
||||
/// [`ErrorKind::UnexpectedEof`]. The contents of `buf` are unspecified
|
||||
/// in this case.
|
||||
///
|
||||
/// If any other read error is encountered then the operation
|
||||
|
@ -116,13 +116,13 @@
|
||||
//! Finally, Tokio provides a _runtime_ for executing asynchronous tasks. Most
|
||||
//! applications can use the [`#[tokio::main]`][main] macro to run their code on the
|
||||
//! Tokio runtime. In use-cases where manual control over the runtime is
|
||||
//! required, the [`tokio::runtime`] module provides APIs for configuring and
|
||||
//! required, the [`tokio::runtime`] module provides APIs for configuring and
|
||||
//! managing runtimes.
|
||||
//!
|
||||
//! Using the runtime requires the "rt-core" or "rt-threaded" feature flags, to
|
||||
//! enable the basic [single-threaded scheduler][rt-core] and the [thread-pool
|
||||
//! scheduler][rt-threaded], respectively. See the [`runtime` module
|
||||
//! documentation][rt-features] for details. In addition, the "macros" feature
|
||||
//! documentation][rt-features] for details. In addition, the "macros" feature
|
||||
//! flag enables the `#[tokio::main]` and `#[tokio::test]` attributes.
|
||||
//!
|
||||
//! [main]: attr.main.html
|
||||
|
@ -11,7 +11,7 @@
|
||||
//! * [`UdpSocket`] provides functionality for communication over UDP
|
||||
//! * [`UnixListener`] and [`UnixStream`] provide functionality for communication over a
|
||||
//! Unix Domain Stream Socket **(available on Unix only)**
|
||||
//! * [`UnixDatagram`] and [`UnixDatagramFramed`] provide functionality for communication
|
||||
//! * [`UnixDatagram`] provides functionality for communication
|
||||
//! over Unix Domain Datagram Socket **(available on Unix only)**
|
||||
|
||||
//!
|
||||
@ -21,7 +21,6 @@
|
||||
//! [`UnixListener`]: struct.UnixListener.html
|
||||
//! [`UnixStream`]: struct.UnixStream.html
|
||||
//! [`UnixDatagram`]: struct.UnixDatagram.html
|
||||
//! [`UnixDatagramFramed`]: struct.UnixDatagramFramed.html
|
||||
|
||||
mod addr;
|
||||
pub use addr::ToSocketAddrs;
|
||||
|
@ -543,7 +543,7 @@ impl TcpStream {
|
||||
///
|
||||
/// This option controls the action taken when a stream has unsent messages
|
||||
/// and the stream is closed. If `SO_LINGER` is set, the system
|
||||
/// shall block the process until it can transmit the data or until the
|
||||
/// shall block the process until it can transmit the data or until the
|
||||
/// time expires.
|
||||
///
|
||||
/// If `SO_LINGER` is not specified, and the stream is closed, the system
|
||||
|
@ -128,7 +128,7 @@ impl Inner {
|
||||
|
||||
fn park_timeout(&self, dur: Duration) {
|
||||
// Like `park` above we have a fast path for an already-notified thread,
|
||||
// and afterwards we start coordinating for a sleep. return quickly.
|
||||
// and afterwards we start coordinating for a sleep. Return quickly.
|
||||
if self
|
||||
.state
|
||||
.compare_exchange(NOTIFIED, EMPTY, SeqCst, SeqCst)
|
||||
|
@ -304,7 +304,7 @@ impl Runtime {
|
||||
/// [basic scheduler] is used instead.
|
||||
///
|
||||
/// If the threaded cheduler is selected, it will not spawn
|
||||
/// any worker threads until it needs to, i.e. tasks are scheduled to run.
|
||||
/// any worker threads until it needs to, i.e. tasks are scheduled to run.
|
||||
///
|
||||
/// Most applications will not need to call this function directly. Instead,
|
||||
/// they will use the [`#[tokio::main]` attribute][main]. When more complex
|
||||
|
@ -279,7 +279,7 @@ where
|
||||
// TODO: This check may not be required as it most
|
||||
// likely can only return `true` at this point. A
|
||||
// channel is closed when all tx handles are
|
||||
// dropped. Dropping a tx handle releases memory,
|
||||
// dropped. Dropping a tx handle releases memory,
|
||||
// which ensures that if dropping the tx handle is
|
||||
// visible, then all messages sent are also visible.
|
||||
assert!(self.inner.semaphore.is_idle());
|
||||
|
@ -5,7 +5,7 @@ cfg_rt_threaded! {
|
||||
///
|
||||
/// In general, issuing a blocking call or performing a lot of compute in a
|
||||
/// future without yielding is not okay, as it may prevent the executor from
|
||||
/// driving other futures forward. If you run a closure through this method,
|
||||
/// driving other futures forward. If you run a closure through this method,
|
||||
/// the current executor thread will relegate all its executor duties to another
|
||||
/// (possibly new) thread, and only then poll the task. Note that this requires
|
||||
/// additional synchronization.
|
||||
|
@ -538,7 +538,7 @@ where
|
||||
}
|
||||
|
||||
unsafe fn wake_join(&self) {
|
||||
// LOOM: ensure we can make this call
|
||||
// LOOM: ensure we can make this call
|
||||
self.trailer().waker.check();
|
||||
self.trailer().waker.with_unchecked(|ptr| {
|
||||
(*(*ptr).as_ptr())
|
||||
|
@ -4,7 +4,7 @@ use crate::task::JoinHandle;
|
||||
use std::future::Future;
|
||||
|
||||
/// Spawns a new asynchronous task, returning a
|
||||
/// [`JoinHandle`](super::JoinHandle)] for it.
|
||||
/// [`JoinHandle`](super::JoinHandle) for it.
|
||||
///
|
||||
/// Spawning a task enables the task to execute concurrently to other tasks. The
|
||||
/// spawned task may execute on the current thread, or it may be sent to a
|
||||
|
@ -531,7 +531,7 @@ impl<T> DelayQueue<T> {
|
||||
/// of an `Instant`.
|
||||
///
|
||||
/// The item remains in the queue but the delay is set to expire after
|
||||
/// `timeout`. If `timeout` is zero, then the item is immediately made
|
||||
/// `timeout`. If `timeout` is zero, then the item is immediately made
|
||||
/// available to the caller.
|
||||
///
|
||||
/// # Panics
|
||||
|
@ -54,7 +54,7 @@ use std::{cmp, fmt};
|
||||
/// instant, and processes each entry for that slot. When the timer reaches the
|
||||
/// end of the wheel, it starts again at the beginning.
|
||||
///
|
||||
/// The implementation maintains six wheels arranged in a set of levels. As the
|
||||
/// The implementation maintains six wheels arranged in a set of levels. As the
|
||||
/// levels go up, the slots of the associated wheel represent larger intervals
|
||||
/// of time. At each level, the wheel has 64 slots. Each slot covers a range of
|
||||
/// time equal to the wheel at the lower level. At level zero, each slot
|
||||
|
@ -102,7 +102,7 @@ fn remove_remote_and_reuse() {
|
||||
let value = get_val(&s, idx1);
|
||||
|
||||
// We may or may not see the new value yet, depending on when
|
||||
// this occurs, but we must either see the new value or `None`;
|
||||
// this occurs, but we must either see the new value or `None`;
|
||||
// the old value has been removed!
|
||||
assert!(value == None || value == Some(3));
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user