summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nosov <olegnosov1@gmail.com>2020-01-24 20:31:13 +0300
committerCarl Lerche <me@carllerche.com>2020-01-24 09:31:13 -0800
commitf9ddb93604a830d106475bd4c4cae436fafcc0da (patch)
tree6f200680e68b290794ef0512dcb031ef6d81c5ea
parenta70f7203a46d471345128832987017612d8e4585 (diff)
docs: use third form in API docs (#2027)
-rw-r--r--tokio-test/src/macros.rs10
-rw-r--r--tokio-test/src/task.rs13
-rw-r--r--tokio/src/fs/create_dir_all.rs2
-rw-r--r--tokio/src/fs/file.rs4
-rw-r--r--tokio/src/fs/metadata.rs2
-rw-r--r--tokio/src/fs/read.rs2
-rw-r--r--tokio/src/fs/read_dir.rs4
-rw-r--r--tokio/src/fs/rename.rs2
-rw-r--r--tokio/src/future/maybe_done.rs2
-rw-r--r--tokio/src/future/ready.rs2
-rw-r--r--tokio/src/io/async_buf_read.rs4
-rw-r--r--tokio/src/io/async_read.rs6
-rw-r--r--tokio/src/io/async_seek.rs4
-rw-r--r--tokio/src/io/async_write.rs4
-rw-r--r--tokio/src/io/blocking.rs2
-rw-r--r--tokio/src/io/driver/mod.rs2
-rw-r--r--tokio/src/io/poll_evented.rs6
-rw-r--r--tokio/src/io/registration.rs12
-rw-r--r--tokio/src/io/split.rs8
-rw-r--r--tokio/src/io/util/async_buf_read_ext.rs4
-rw-r--r--tokio/src/io/util/async_read_ext.rs20
-rw-r--r--tokio/src/io/util/async_write_ext.rs10
-rw-r--r--tokio/src/io/util/buf_stream.rs2
-rw-r--r--tokio/src/loom/std/atomic_u32.rs2
-rw-r--r--tokio/src/loom/std/atomic_usize.rs2
-rw-r--r--tokio/src/macros/assert.rs4
-rw-r--r--tokio/src/macros/cfg.rs6
-rw-r--r--tokio/src/net/addr.rs2
-rw-r--r--tokio/src/net/tcp/incoming.rs6
-rw-r--r--tokio/src/net/tcp/listener.rs11
-rw-r--r--tokio/src/net/tcp/stream.rs12
-rw-r--r--tokio/src/net/udp/socket.rs6
-rw-r--r--tokio/src/net/unix/datagram.rs2
-rw-r--r--tokio/src/net/unix/incoming.rs7
-rw-r--r--tokio/src/park/mod.rs8
-rw-r--r--tokio/src/process/kill.rs2
-rw-r--r--tokio/src/process/mod.rs10
-rw-r--r--tokio/src/process/unix/orphan.rs4
-rw-r--r--tokio/src/runtime/basic_scheduler.rs4
-rw-r--r--tokio/src/runtime/blocking/shutdown.rs2
-rw-r--r--tokio/src/runtime/blocking/task.rs2
-rw-r--r--tokio/src/runtime/builder.rs24
-rw-r--r--tokio/src/runtime/handle.rs2
-rw-r--r--tokio/src/runtime/park.rs2
-rw-r--r--tokio/src/runtime/thread_pool/mod.rs4
-rw-r--r--tokio/src/runtime/thread_pool/queue/global.rs2
-rw-r--r--tokio/src/runtime/thread_pool/queue/inject.rs8
-rw-r--r--tokio/src/runtime/thread_pool/queue/local.rs8
-rw-r--r--tokio/src/runtime/thread_pool/queue/worker.rs8
-rw-r--r--tokio/src/runtime/thread_pool/shutdown.rs2
-rw-r--r--tokio/src/runtime/thread_pool/slice.rs6
-rw-r--r--tokio/src/runtime/thread_pool/spawner.rs2
-rw-r--r--tokio/src/runtime/thread_pool/worker.rs10
-rw-r--r--tokio/src/signal/registry.rs20
-rw-r--r--tokio/src/signal/unix.rs8
-rw-r--r--tokio/src/signal/windows.rs4
-rw-r--r--tokio/src/sync/barrier.rs2
-rw-r--r--tokio/src/sync/broadcast.rs10
-rw-r--r--tokio/src/sync/mpsc/block.rs14
-rw-r--r--tokio/src/sync/mpsc/bounded.rs6
-rw-r--r--tokio/src/sync/mpsc/chan.rs2
-rw-r--r--tokio/src/sync/mpsc/list.rs8
-rw-r--r--tokio/src/sync/mpsc/unbounded.rs4
-rw-r--r--tokio/src/sync/mutex.rs2
-rw-r--r--tokio/src/sync/oneshot.rs6
-rw-r--r--tokio/src/sync/semaphore.rs8
-rw-r--r--tokio/src/sync/semaphore_ll.rs36
-rw-r--r--tokio/src/sync/watch.rs6
-rw-r--r--tokio/src/task/blocking.rs4
-rw-r--r--tokio/src/task/core.rs2
-rw-r--r--tokio/src/task/harness.rs6
-rw-r--r--tokio/src/task/local.rs4
-rw-r--r--tokio/src/task/queue.rs26
-rw-r--r--tokio/src/task/state.rs22
-rw-r--r--tokio/src/task/yield_now.rs13
-rw-r--r--tokio/src/time/delay.rs8
-rw-r--r--tokio/src/time/delay_queue.rs16
-rw-r--r--tokio/src/time/driver/atomic_stack.rs6
-rw-r--r--tokio/src/time/driver/handle.rs6
-rw-r--r--tokio/src/time/driver/mod.rs12
-rw-r--r--tokio/src/time/driver/stack.rs2
-rw-r--r--tokio/src/time/error.rs4
-rw-r--r--tokio/src/time/throttle.rs2
83 files changed, 288 insertions, 278 deletions
diff --git a/tokio-test/src/macros.rs b/tokio-test/src/macros.rs
index dbe2280f..299bd775 100644
--- a/tokio-test/src/macros.rs
+++ b/tokio-test/src/macros.rs
@@ -1,6 +1,6 @@
//! A collection of useful macros for testing futures and tokio based code
-/// Assert a `Poll` is ready, returning the value.
+/// Asserts a `Poll` is ready, returning the value.
///
/// This will invoke `panic!` if the provided `Poll` does not evaluate to `Poll::Ready` at
/// runtime.
@@ -39,7 +39,7 @@ macro_rules! assert_ready {
}};
}
-/// Assert a `Poll<Result<...>>` is ready and `Ok`, returning the value.
+/// Asserts a `Poll<Result<...>>` is ready and `Ok`, returning the value.
///
/// This will invoke `panic!` if the provided `Poll` does not evaluate to `Poll::Ready(Ok(..))` at
/// runtime.
@@ -72,7 +72,7 @@ macro_rules! assert_ready_ok {
}};
}
-/// Assert a `Poll<Result<...>>` is ready and `Err`, returning the error.
+/// Asserts a `Poll<Result<...>>` is ready and `Err`, returning the error.
///
/// This will invoke `panic!` if the provided `Poll` does not evaluate to `Poll::Ready(Err(..))` at
/// runtime.
@@ -105,7 +105,7 @@ macro_rules! assert_ready_err {
}};
}
-/// Assert a `Poll` is pending.
+/// Asserts a `Poll` is pending.
///
/// This will invoke `panic!` if the provided `Poll` does not evaluate to `Poll::Pending` at
/// runtime.
@@ -144,7 +144,7 @@ macro_rules! assert_pending {
}};
}
-/// Assert if a poll is ready and check for equality on the value
+/// Asserts if a poll is ready and check for equality on the value
///
/// This will invoke `panic!` if the provided `Poll` does not evaluate to `Poll::Ready` at
/// runtime and the value produced does not partially equal the expected value.
diff --git a/tokio-test/src/task.rs b/tokio-test/src/task.rs
index 71ebe7b4..04328e3d 100644
--- a/tokio-test/src/task.rs
+++ b/tokio-test/src/task.rs
@@ -45,7 +45,7 @@ const WAKE: usize = 1;
const SLEEP: usize = 2;
impl<T> Spawn<T> {
- /// Consume `self` returning the inner value
+ /// Consumes `self` returning the inner value
pub fn into_inner(mut self) -> T
where
T: Unpin,
@@ -101,7 +101,7 @@ impl<T: Unpin> ops::DerefMut for Spawn<T> {
}
impl<T: Future> Spawn<T> {
- /// Poll a future
+ /// Polls a future
pub fn poll(&mut self) -> Poll<T::Output> {
let fut = self.future.as_mut();
self.task.enter(|cx| fut.poll(cx))
@@ -109,7 +109,7 @@ impl<T: Future> Spawn<T> {
}
impl<T: Stream> Spawn<T> {
- /// Poll a stream
+ /// Polls a stream
pub fn poll_next(&mut self) -> Poll<Option<T::Item>> {
let stream = self.future.as_mut();
self.task.enter(|cx| stream.poll_next(cx))
@@ -117,14 +117,14 @@ impl<T: Stream> Spawn<T> {
}
impl MockTask {
- /// Create a new mock task
+ /// Creates new mock task
fn new() -> Self {
MockTask {
waker: Arc::new(ThreadWaker::new()),
}
}
- /// Run a closure from the context of the task.
+ /// Runs a closure from the context of the task.
///
/// Any wake notifications resulting from the execution of the closure are
/// tracked.
@@ -190,8 +190,7 @@ impl ThreadWaker {
}
fn wake(&self) {
- // First, try transitioning from IDLE -> NOTIFY, this does not require a
- // lock.
+ // First, try transitioning from IDLE -> NOTIFY, this does not require a lock.
let mut state = self.state.lock().unwrap();
let prev = *state;
diff --git a/tokio/src/fs/create_dir_all.rs b/tokio/src/fs/create_dir_all.rs
index 7d89280d..21f0c82d 100644
--- a/tokio/src/fs/create_dir_all.rs
+++ b/tokio/src/fs/create_dir_all.rs
@@ -3,7 +3,7 @@ use crate::fs::asyncify;
use std::io;
use std::path::Path;
-/// Recursively create a directory and all of its parent components if they
+/// Recursively creates a directory and all of its parent components if they
/// are missing.
///
/// This is an async version of [`std::fs::create_dir_all`][std]
diff --git a/tokio/src/fs/file.rs b/tokio/src/fs/file.rs
index 9110831a..a1f22fc9 100644
--- a/tokio/src/fs/file.rs
+++ b/tokio/src/fs/file.rs
@@ -155,7 +155,7 @@ impl File {
Ok(File::from_std(std_file))
}
- /// Convert a [`std::fs::File`][std] to a [`tokio::fs::File`][file].
+ /// Converts a [`std::fs::File`][std] to a [`tokio::fs::File`][file].
///
/// [std]: std::fs::File
/// [file]: File
@@ -176,7 +176,7 @@ impl File {
}
}
- /// Seek to an offset, in bytes, in a stream.
+ /// Seeks to an offset, in bytes, in a stream.
///
/// # Examples
///
diff --git a/tokio/src/fs/metadata.rs b/tokio/src/fs/metadata.rs
index 6bbb44ad..ff9cded7 100644
--- a/tokio/src/fs/metadata.rs
+++ b/tokio/src/fs/metadata.rs
@@ -4,7 +4,7 @@ use std::fs::Metadata;
use std::io;
use std::path::Path;
-/// Given a path, query the file system to get information about a file,
+/// Given a path, queries the file system to get information about a file,
/// directory, etc.
///
/// This is an async version of [`std::fs::metadata`][std]
diff --git a/tokio/src/fs/read.rs b/tokio/src/fs/read.rs
index f61275d0..2d80eb5b 100644
--- a/tokio/src/fs/read.rs
+++ b/tokio/src/fs/read.rs
@@ -2,7 +2,7 @@ use crate::fs::asyncify;
use std::{io, path::Path};
-/// Read the entire contents of a file into a bytes vector.
+/// Reads the entire contents of a file into a bytes vector.
///
/// This is an async version of [`std::fs::read`][std]
///
diff --git a/tokio/src/fs/read_dir.rs b/tokio/src/fs/read_dir.rs
index 06eed384..fbc006df 100644
--- a/tokio/src/fs/read_dir.rs
+++ b/tokio/src/fs/read_dir.rs
@@ -165,7 +165,7 @@ impl DirEntry {
self.0.file_name()
}
- /// Return the metadata for the file that this entry points at.
+ /// Returns the metadata for the file that this entry points at.
///
/// This function will not traverse symlinks if this entry points at a
/// symlink.
@@ -200,7 +200,7 @@ impl DirEntry {
asyncify(move || std.metadata()).await
}
- /// Return the file type for the file that this entry points at.
+ /// Returns the file type for the file that this entry points at.
///
/// This function will not traverse symlinks if this entry points at a
/// symlink.
diff --git a/tokio/src/fs/rename.rs b/tokio/src/fs/rename.rs
index de647da9..4f980821 100644
--- a/tokio/src/fs/rename.rs
+++ b/tokio/src/fs/rename.rs
@@ -3,7 +3,7 @@ use crate::fs::asyncify;
use std::io;
use std::path::Path;
-/// Rename a file or directory to a new name, replacing the original file if
+/// Renames a file or directory to a new name, replacing the original file if
/// `to` already exists.
///
/// This will not work if the new name is on a different mount point.
diff --git a/tokio/src/future/maybe_done.rs b/tokio/src/future/maybe_done.rs
index 94b829f2..e93af521 100644
--- a/tokio/src/future/maybe_done.rs
+++ b/tokio/src/future/maybe_done.rs
@@ -40,7 +40,7 @@ impl<Fut: Future> MaybeDone<Fut> {
}
}
- /// Attempt to take the output of a `MaybeDone` without driving it
+ /// Attempts to take the output of a `MaybeDone` without driving it
/// towards completion.
#[inline]
pub fn take_output(self: Pin<&mut Self>) -> Option<Fut::Output> {
diff --git a/tokio/src/future/ready.rs b/tokio/src/future/ready.rs
index ba5d4804..d74f999e 100644
--- a/tokio/src/future/ready.rs
+++ b/tokio/src/future/ready.rs
@@ -21,7 +21,7 @@ impl<T> Future for Ready<T> {
}
}
-/// Create a future that is immediately ready with a success value.
+/// Creates a future that is immediately ready with a success value.
pub(crate) fn ok<T, E>(t: T) -> Ready<Result<T, E>> {
Ready(Some(Ok(t)))
}
diff --git a/tokio/src/io/async_buf_read.rs b/tokio/src/io/async_buf_read.rs
index 18127351..1ab73cd9 100644
--- a/tokio/src/io/async_buf_read.rs
+++ b/tokio/src/io/async_buf_read.rs
@@ -5,7 +5,7 @@ use std::ops::DerefMut;
use std::pin::Pin;
use std::task::{Context, Poll};
-/// Read bytes asynchronously.
+/// Reads bytes asynchronously.
///
/// This trait inherits from [`std::io::BufRead`] and indicates that an I/O object is
/// **non-blocking**. All non-blocking I/O objects must return an error when
@@ -17,7 +17,7 @@ use std::task::{Context, Poll};
/// [`std::io::BufRead`]: std::io::BufRead
/// [`AsyncBufReadExt`]: crate::io::AsyncBufReadExt
pub trait AsyncBufRead: AsyncRead {
- /// Attempt to return the contents of the internal buffer, filling it with more data
+ /// Attempts to return the contents of the internal buffer, filling it with more data
/// from the inner reader if it is empty.
///
/// On success, returns `Poll::Ready(Ok(buf))`.
diff --git a/tokio/src/io/async_read.rs b/tokio/src/io/async_read.rs
index 24c1b4ef..de08d658 100644
--- a/tokio/src/io/async_read.rs
+++ b/tokio/src/io/async_read.rs
@@ -5,7 +5,7 @@ use std::ops::DerefMut;
use std::pin::Pin;
use std::task::{Context, Poll};
-/// Read bytes from a source.
+/// Reads bytes from a source.
///
/// This trait is analogous to the [`std::io::Read`] trait, but integrates with
/// the asynchronous task system. In particular, the [`poll_read`] method,
@@ -82,7 +82,7 @@ pub trait AsyncRead {
true
}
- /// Attempt to read from the `AsyncRead` into `buf`.
+ /// Attempts to read from the `AsyncRead` into `buf`.
///
/// On success, returns `Poll::Ready(Ok(num_bytes_read))`.
///
@@ -96,7 +96,7 @@ pub trait AsyncRead {
buf: &mut [u8],
) -> Poll<io::Result<usize>>;
- /// Pull some bytes from this source into the specified `BufMut`, returning
+ /// Pulls some bytes from this source into the specified `BufMut`, returning
/// how many bytes were read.
///
/// The `buf` provided will have bytes read into it and the internal cursor
diff --git a/tokio/src/io/async_seek.rs b/tokio/src/io/async_seek.rs
index f3e6fcdc..0be9c90d 100644
--- a/tokio/src/io/async_seek.rs
+++ b/tokio/src/io/async_seek.rs
@@ -16,7 +16,7 @@ use std::task::{Context, Poll};
/// [`Seek::seek`]: std::io::Seek::seek()
/// [`AsyncSeekExt`]: crate::io::AsyncSeekExt
pub trait AsyncSeek {
- /// Attempt to seek to an offset, in bytes, in a stream.
+ /// Attempts to seek to an offset, in bytes, in a stream.
///
/// A seek beyond the end of a stream is allowed, but behavior is defined
/// by the implementation.
@@ -29,7 +29,7 @@ pub trait AsyncSeek {
position: SeekFrom,
) -> Poll<io::Result<()>>;
- /// Wait for a seek operation to complete.
+ /// Waits for a seek operation to complete.
///
/// If the seek operation completed successfully,
/// this method returns the new position from the start of the stream.
diff --git a/tokio/src/io/async_write.rs b/tokio/src/io/async_write.rs
index 8ae7cf84..0bfed056 100644
--- a/tokio/src/io/async_write.rs
+++ b/tokio/src/io/async_write.rs
@@ -58,7 +58,7 @@ pub trait AsyncWrite {
buf: &[u8],
) -> Poll<Result<usize, io::Error>>;
- /// Attempt to flush the object, ensuring that any buffered data reach
+ /// Attempts to flush the object, ensuring that any buffered data reach
/// their destination.
///
/// On success, returns `Poll::Ready(Ok(()))`.
@@ -129,7 +129,7 @@ pub trait AsyncWrite {
/// task.
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), io::Error>>;
- /// Write a `Buf` into this value, returning how many bytes were written.
+ /// Writes a `Buf` into this value, returning how many bytes were written.
///
/// Note that this method will advance the `buf` provided automatically by
/// the number of bytes written.
diff --git a/tokio/src/io/blocking.rs b/tokio/src/io/blocking.rs
index 87b251b7..2491039a 100644
--- a/tokio/src/io/blocking.rs
+++ b/tokio/src/io/blocking.rs
@@ -16,7 +16,7 @@ use self::State::*;
pub(crate) struct Blocking<T> {
inner: Option<T>,
state: State<T>,
- /// true if the lower IO layer needs flushing
+ /// `true` if the lower IO layer needs flushing
need_flush: bool,
}
diff --git a/tokio/src/io/driver/mod.rs b/tokio/src/io/driver/mod.rs
index a36a40fa..fb3104f1 100644
--- a/tokio/src/io/driver/mod.rs
+++ b/tokio/src/io/driver/mod.rs
@@ -236,7 +236,7 @@ impl fmt::Debug for Handle {
// ===== impl Inner =====
impl Inner {
- /// Register an I/O resource with the reactor.
+ /// Registers an I/O resource with the reactor.
///
/// The registration token is returned.
pub(super) fn add_source(&self, source: &dyn Evented) -> io::Result<Address> {
diff --git a/tokio/src/io/poll_evented.rs b/tokio/src/io/poll_evented.rs
index 6c795b8b..c651b77e 100644
--- a/tokio/src/io/poll_evented.rs
+++ b/tokio/src/io/poll_evented.rs
@@ -212,7 +212,7 @@ where
Ok(io)
}
- /// Check the I/O resource's read readiness state.
+ /// Checks the I/O resource's read readiness state.
///
/// The mask argument allows specifying what readiness to notify on. This
/// can be any value, including platform specific readiness, **except**
@@ -280,12 +280,12 @@ where
Ok(())
}
- /// Check the I/O resource's write readiness state.
+ /// Checks the I/O resource's write readiness state.
///
/// This always checks for writable readiness and also checks for HUP
/// readiness on platforms that support it.
///
- /// If the resource is not ready for a write then `Async::NotReady` is
+ /// If the resource is not ready for a write then `Poll::Pending` is
/// returned and the current task is notified once a new event is received.
///
/// The I/O resource will remain in a write-ready state until readiness is
diff --git a/tokio/src/io/registration.rs b/tokio/src/io/registration.rs
index 16e8fe4d..e9497a7e 100644
--- a/tokio/src/io/registration.rs
+++ b/tokio/src/io/registration.rs
@@ -47,7 +47,7 @@ cfg_io_driver! {
// ===== impl Registration =====
impl Registration {
- /// Register the I/O resource with the default reactor.
+ /// Registers the I/O resource with the default reactor.
///