mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-17 00:00:11 +02:00
Update doc comments (#2572)
* Update doc comments * Remove trailing whitespace
This commit is contained in:
@@ -2,7 +2,7 @@ use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
|
||||
/// Future for the [`ready`](ready()) function.
|
||||
/// Future for the [`ok`](ok()) function.
|
||||
///
|
||||
/// `pub` in order to use the future as an associated type in a sealed trait.
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -8,7 +8,8 @@ use std::task::{Context, Poll};
|
||||
cfg_io_util! {
|
||||
/// A future used to fully flush an I/O object.
|
||||
///
|
||||
/// Created by the [`AsyncWriteExt::flush`] function.
|
||||
/// Created by the [`AsyncWriteExt::flush`][flush] function.
|
||||
/// [flush]: crate::io::AsyncWriteExt::flush
|
||||
#[derive(Debug)]
|
||||
pub struct Flush<'a, A: ?Sized> {
|
||||
a: &'a mut A,
|
||||
|
||||
@@ -15,7 +15,7 @@ where
|
||||
}
|
||||
|
||||
cfg_io_util! {
|
||||
/// Future returned by [`read_buf`](AsyncReadExt::read_buf).
|
||||
/// Future returned by [`read_buf`](crate::io::AsyncReadExt::read_buf).
|
||||
#[derive(Debug)]
|
||||
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||
pub struct ReadBuf<'a, R, B> {
|
||||
|
||||
@@ -9,7 +9,8 @@ use std::task::{Context, Poll};
|
||||
/// A future which can be used to easily read exactly enough bytes to fill
|
||||
/// a buffer.
|
||||
///
|
||||
/// Created by the [`AsyncRead::read_exact`].
|
||||
/// Created by the [`AsyncReadExt::read_exact`][read_exact].
|
||||
/// [read_exact]: [crate::io::AsyncReadExt::read_exact]
|
||||
pub(crate) fn read_exact<'a, A>(reader: &'a mut A, buf: &'a mut [u8]) -> ReadExact<'a, A>
|
||||
where
|
||||
A: AsyncRead + Unpin + ?Sized,
|
||||
|
||||
@@ -8,7 +8,8 @@ use std::task::{Context, Poll};
|
||||
cfg_io_util! {
|
||||
/// A future used to shutdown an I/O object.
|
||||
///
|
||||
/// Created by the [`AsyncWriteExt::shutdown`] function.
|
||||
/// Created by the [`AsyncWriteExt::shutdown`][shutdown] function.
|
||||
/// [shutdown]: crate::io::AsyncWriteExt::shutdown
|
||||
#[derive(Debug)]
|
||||
pub struct Shutdown<'a, A: ?Sized> {
|
||||
a: &'a mut A,
|
||||
|
||||
@@ -47,9 +47,9 @@ cfg_rt_core! {
|
||||
}
|
||||
}
|
||||
|
||||
/// Set this [`ThreadContext`] as the current active [`ThreadContext`].
|
||||
/// Set this [`Handle`] as the current active [`Handle`].
|
||||
///
|
||||
/// [`ThreadContext`]: struct@ThreadContext
|
||||
/// [`Handle`]: Handle
|
||||
pub(crate) fn enter<F, R>(new: Handle, f: F) -> R
|
||||
where
|
||||
F: FnOnce() -> R,
|
||||
|
||||
@@ -26,29 +26,29 @@ use std::sync::Arc;
|
||||
use std::usize;
|
||||
use std::{cmp, fmt};
|
||||
|
||||
/// Time implementation that drives [`Delay`], [`Interval`], and [`Timeout`].
|
||||
/// Time implementation that drives [`Delay`][delay], [`Interval`][interval], and [`Timeout`][timeout].
|
||||
///
|
||||
/// A `Driver` instance tracks the state necessary for managing time and
|
||||
/// notifying the [`Delay`] instances once their deadlines are reached.
|
||||
/// notifying the [`Delay`][delay] instances once their deadlines are reached.
|
||||
///
|
||||
/// It is expected that a single instance manages many individual [`Delay`]
|
||||
/// It is expected that a single instance manages many individual [`Delay`][delay]
|
||||
/// instances. The `Driver` implementation is thread-safe and, as such, is able
|
||||
/// to handle callers from across threads.
|
||||
///
|
||||
/// After creating the `Driver` instance, the caller must repeatedly call
|
||||
/// [`turn`]. The time driver will perform no work unless [`turn`] is called
|
||||
/// repeatedly.
|
||||
/// After creating the `Driver` instance, the caller must repeatedly call `park`
|
||||
/// or `park_timeout`. The time driver will perform no work unless `park` or
|
||||
/// `park_timeout` is called repeatedly.
|
||||
///
|
||||
/// The driver has a resolution of one millisecond. Any unit of time that falls
|
||||
/// between milliseconds are rounded up to the next millisecond.
|
||||
///
|
||||
/// When an instance is dropped, any outstanding [`Delay`] instance that has not
|
||||
/// When an instance is dropped, any outstanding [`Delay`][delay] instance that has not
|
||||
/// elapsed will be notified with an error. At this point, calling `poll` on the
|
||||
/// [`Delay`] instance will result in `Err` being returned.
|
||||
/// [`Delay`][delay] instance will result in panic.
|
||||
///
|
||||
/// # Implementation
|
||||
///
|
||||
/// THe time driver is based on the [paper by Varghese and Lauck][paper].
|
||||
/// The time driver is based on the [paper by Varghese and Lauck][paper].
|
||||
///
|
||||
/// A hashed timing wheel is a vector of slots, where each slot handles a time
|
||||
/// slice. As time progresses, the timer walks over the slot for the current
|
||||
@@ -73,9 +73,14 @@ use std::{cmp, fmt};
|
||||
/// When the timer processes entries at level zero, it will notify all the
|
||||
/// `Delay` instances as their deadlines have been reached. For all higher
|
||||
/// levels, all entries will be redistributed across the wheel at the next level
|
||||
/// down. Eventually, as time progresses, entries will [`Delay`] instances will
|
||||
/// down. Eventually, as time progresses, entries will [`Delay`][delay] instances will
|
||||
/// either be canceled (dropped) or their associated entries will reach level
|
||||
/// zero and be notified.
|
||||
///
|
||||
/// [paper]: http://www.cs.columbia.edu/~nahum/w6998/papers/ton97-timing-wheels.pdf
|
||||
/// [delay]: crate::time::Delay
|
||||
/// [timeout]: crate::time::Timeout
|
||||
/// [interval]: crate::time::Interval
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Driver<T> {
|
||||
/// Shared state
|
||||
@@ -119,7 +124,7 @@ where
|
||||
T: Park,
|
||||
{
|
||||
/// Creates a new `Driver` instance that uses `park` to block the current
|
||||
/// thread and `now` to get the current `Instant`.
|
||||
/// thread and `clock` to get the current `Instant`.
|
||||
///
|
||||
/// Specifying the source of time is useful when testing.
|
||||
pub(crate) fn new(park: T, clock: Clock) -> Driver<T> {
|
||||
|
||||
Reference in New Issue
Block a user