docs: fix all rustdoc warnings (#1474)

This commit is contained in:
Ivan Petkov
2019-08-18 14:38:54 -07:00
committed by Carl Lerche
parent 08b07afbd9
commit 68d5fcb8d1
27 changed files with 69 additions and 100 deletions
+15 -13
View File
@@ -115,16 +115,18 @@ jobs:
# parameters: # parameters:
# name: tsan # name: tsan
# rust: $(nightly) # rust: $(nightly)
#
# - template: ci/azure-deploy-docs.yml - template: ci/azure-deploy-docs.yml
# parameters: parameters:
# dependsOn: rust: $(nightly)
# - rustfmt dependsOn:
# - test_tokio - rustfmt
# - test_sub_cross - clippy
# - test_linux - test_tokio
# - features - test_sub_cross
# - test_nightly - test_linux
# - cross_32bit_linux - test_features
# - minrust # - test_nightly
# - tsan # - cross_32bit_linux
# - minrust
# - tsan
+3 -2
View File
@@ -12,9 +12,10 @@ jobs:
steps: steps:
- template: azure-install-rust.yml - template: azure-install-rust.yml
parameters: parameters:
rust_version: stable # rust_version: stable
rust_version: ${{ parameters.rust }}
- script: | - script: |
cargo doc --all --no-deps cargo doc --all --no-deps --all-features
cp -R target/doc '$(Build.BinariesDirectory)' cp -R target/doc '$(Build.BinariesDirectory)'
displayName: 'Generate Documentation' displayName: 'Generate Documentation'
- script: | - script: |
+1
View File
@@ -20,6 +20,7 @@ use crate::SpawnError;
/// such, the function takes a stream and an executor on which the background /// such, the function takes a stream and an executor on which the background
/// task is spawned. /// task is spawned.
/// ///
/// [`spawn`]: TypedExecutor::spawn
/// ``` /// ```
/// #![feature(async_await)] /// #![feature(async_await)]
/// ///
+1 -1
View File
@@ -59,7 +59,7 @@ pub trait AsyncRead {
/// ///
/// This function is called from [`poll_read_buf`]. /// This function is called from [`poll_read_buf`].
/// ///
/// [`io::Read`]: https://doc.rust-lang.org/std/io/trait.Read.html /// [`io::Read`]: std::io::Read
/// [`poll_read_buf`]: #method.poll_read_buf /// [`poll_read_buf`]: #method.poll_read_buf
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [u8]) -> bool { unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [u8]) -> bool {
for x in buf { for x in buf {
-3
View File
@@ -22,9 +22,6 @@ use std::{cmp, fmt};
/// When the `BufReader` is dropped, the contents of its buffer will be /// When the `BufReader` is dropped, the contents of its buffer will be
/// discarded. Creating multiple instances of a `BufReader` on the same /// discarded. Creating multiple instances of a `BufReader` on the same
/// stream can cause data loss. /// stream can cause data loss.
///
/// [`AsyncRead`]: tokio_io::AsyncRead
///
// TODO: Examples // TODO: Examples
pub struct BufReader<R> { pub struct BufReader<R> {
inner: R, inner: R,
+1 -1
View File
@@ -24,7 +24,7 @@ use std::task::{Context, Poll};
/// stream can cause data loss. If you need to write out the contents of its /// stream can cause data loss. If you need to write out the contents of its
/// buffer, you must manually call flush before the writer is dropped. /// buffer, you must manually call flush before the writer is dropped.
/// ///
/// [`AsyncWrite`]: tokio_io::AsyncWrite /// [`AsyncWrite`]: AsyncWrite
/// [`flush`]: super::AsyncWriteExt::flush /// [`flush`]: super::AsyncWriteExt::flush
/// ///
// TODO: Examples // TODO: Examples
-2
View File
@@ -7,8 +7,6 @@ use std::task::{Context, Poll};
/// A future used to fully flush an I/O object. /// A future used to fully flush an I/O object.
/// ///
/// Created by the [`AsyncWriteExt::flush`] function. /// Created by the [`AsyncWriteExt::flush`] function.
///
/// [`flush`]: fn.flush.html
#[derive(Debug)] #[derive(Debug)]
pub struct Flush<'a, A: ?Sized> { pub struct Flush<'a, A: ?Sized> {
a: &'a mut A, a: &'a mut A,
-38
View File
@@ -1,41 +1,3 @@
//! Asynchronous I/O.
//!
//! This module is the asynchronous version of `std::io`. Primarily, it
//! defines two traits, [`AsyncRead`] and [`AsyncWrite`], which extend the
//! `Read` and `Write` traits of the standard library.
//!
//! # AsyncRead and AsyncWrite
//!
//! [`AsyncRead`] and [`AsyncWrite`] must only be implemented for
//! non-blocking I/O types that integrate with the futures type system. In
//! other words, these types must never block the thread, and instead the
//! current task is notified when the I/O resource is ready.
//!
//! # Standard input and output
//!
//! Tokio provides asynchronous APIs to standard [input], [output], and [error].
//! These APIs are very similar to the ones provided by `std`, but they also
//! implement [`AsyncRead`] and [`AsyncWrite`].
//!
//! Unlike *most* other Tokio APIs, the standard input / output APIs
//! **must** be used from the context of the Tokio runtime as they require
//! Tokio specific features to function.
//!
//! [input]: fn.stdin.html
//! [output]: fn.stdout.html
//! [error]: fn.stderr.html
//!
//! # `std` re-exports
//!
//! Additionally, [`Error`], [`ErrorKind`], and [`Result`] are re-exported
//! from `std::io` for ease of use.
//!
//! [`AsyncRead`]: trait.AsyncRead.html
//! [`AsyncWrite`]: trait.AsyncWrite.html
//! [`Error`]: struct.Error.html
//! [`ErrorKind`]: enum.ErrorKind.html
//! [`Result`]: type.Result.html
mod async_buf_read_ext; mod async_buf_read_ext;
mod async_read_ext; mod async_read_ext;
mod async_write_ext; mod async_write_ext;
+1 -3
View File
@@ -9,9 +9,7 @@ use std::task::{Context, Poll};
/// A future which can be used to easily read exactly enough bytes to fill /// A future which can be used to easily read exactly enough bytes to fill
/// a buffer. /// a buffer.
/// ///
/// Created by the [`read_exact`] function. /// Created by the [`AsyncRead::read_exact`].
///
/// [`read_exact`]: fn.read_exact.html
pub(crate) fn read_exact<'a, A>(reader: &'a mut A, buf: &'a mut [u8]) -> ReadExact<'a, A> pub(crate) fn read_exact<'a, A>(reader: &'a mut A, buf: &'a mut [u8]) -> ReadExact<'a, A>
where where
A: AsyncRead + Unpin + ?Sized, A: AsyncRead + Unpin + ?Sized,
-2
View File
@@ -7,8 +7,6 @@ use std::task::{Context, Poll};
/// A future used to shutdown an I/O object. /// A future used to shutdown an I/O object.
/// ///
/// Created by the [`AsyncWriteExt::shutdown`] function. /// Created by the [`AsyncWriteExt::shutdown`] function.
///
/// [`shutdown`]: fn.shutdown.html
#[derive(Debug)] #[derive(Debug)]
pub struct Shutdown<'a, A: ?Sized> { pub struct Shutdown<'a, A: ?Sized> {
a: &'a mut A, a: &'a mut A,
+3 -1
View File
@@ -262,8 +262,10 @@ impl TryFrom<TcpListener> for mio::net::TcpListener {
/// Consumes value, returning the mio I/O object. /// Consumes value, returning the mio I/O object.
/// ///
/// See [`tokio_net::util::PollEvented::into_inner`] for more details about /// See [`PollEvented::into_inner`] for more details about
/// resource deregistration that happens during the call. /// resource deregistration that happens during the call.
///
/// [`PollEvented::into_inner`]: crate::util::PollEvented::into_inner
fn try_from(value: TcpListener) -> Result<Self, Self::Error> { fn try_from(value: TcpListener) -> Result<Self, Self::Error> {
value.io.into_inner() value.io.into_inner()
} }
+3 -1
View File
@@ -802,8 +802,10 @@ impl TryFrom<TcpStream> for mio::net::TcpStream {
/// Consumes value, returning the mio I/O object. /// Consumes value, returning the mio I/O object.
/// ///
/// See [`tokio_net::util::PollEvented::into_inner`] for more details about /// See [`PollEvented::into_inner`] for more details about
/// resource deregistration that happens during the call. /// resource deregistration that happens during the call.
///
/// [`PollEvented::into_inner`]: crate::util::PollEvented::into_inner
fn try_from(value: TcpStream) -> Result<Self, Self::Error> { fn try_from(value: TcpStream) -> Result<Self, Self::Error> {
value.io.into_inner() value.io.into_inner()
} }
+2 -2
View File
@@ -4,8 +4,8 @@
//! library, which can be used to implement networking protocols. //! library, which can be used to implement networking protocols.
//! //!
//! The main struct for UDP is the [`UdpSocket`], which represents a UDP socket. //! The main struct for UDP is the [`UdpSocket`], which represents a UDP socket.
//! Reading and writing to it can be done using futures, which return the //!
//! [`Recv`], [`Send`], [`RecvFrom`] and [`SendTo`] structs respectively. //! [`UdpSocket`]: struct.UdpSocket
mod frame; mod frame;
mod socket; mod socket;
+3 -1
View File
@@ -328,8 +328,10 @@ impl TryFrom<UdpSocket> for mio::net::UdpSocket {
/// Consumes value, returning the mio I/O object. /// Consumes value, returning the mio I/O object.
/// ///
/// See [`tokio_net::util::PollEvented::into_inner`] for more details about /// See [`PollEvented::into_inner`] for more details about
/// resource deregistration that happens during the call. /// resource deregistration that happens during the call.
///
/// [`PollEvented::into_inner`]: crate::util::PollEvented::into_inner
fn try_from(value: UdpSocket) -> Result<Self, Self::Error> { fn try_from(value: UdpSocket) -> Result<Self, Self::Error> {
value.io.into_inner() value.io.into_inner()
} }
+3 -1
View File
@@ -201,8 +201,10 @@ impl TryFrom<UnixDatagram> for mio_uds::UnixDatagram {
/// Consumes value, returning the mio I/O object. /// Consumes value, returning the mio I/O object.
/// ///
/// See [`tokio_net::util::PollEvented::into_inner`] for more details about /// See [`PollEvented::into_inner`] for more details about
/// resource deregistration that happens during the call. /// resource deregistration that happens during the call.
///
/// [`PollEvented::into_inner`]: crate::util::PollEvented::into_inner
fn try_from(value: UnixDatagram) -> Result<Self, Self::Error> { fn try_from(value: UnixDatagram) -> Result<Self, Self::Error> {
value.io.into_inner() value.io.into_inner()
} }
+3 -1
View File
@@ -102,8 +102,10 @@ impl TryFrom<UnixListener> for mio_uds::UnixListener {
/// Consumes value, returning the mio I/O object. /// Consumes value, returning the mio I/O object.
/// ///
/// See [`tokio_net::util::PollEvented::into_inner`] for more details about /// See [`PollEvented::into_inner`] for more details about
/// resource deregistration that happens during the call. /// resource deregistration that happens during the call.
///
/// [`PollEvented::into_inner`]: crate::util::PollEvented::into_inner
fn try_from(value: UnixListener) -> Result<Self, Self::Error> { fn try_from(value: UnixListener) -> Result<Self, Self::Error> {
value.io.into_inner() value.io.into_inner()
} }
+3 -1
View File
@@ -131,8 +131,10 @@ impl TryFrom<UnixStream> for mio_uds::UnixStream {
/// Consumes value, returning the mio I/O object. /// Consumes value, returning the mio I/O object.
/// ///
/// See [`tokio_net::util::PollEvented::into_inner`] for more details about /// See [`PollEvented::into_inner`] for more details about
/// resource deregistration that happens during the call. /// resource deregistration that happens during the call.
///
/// [`PollEvented::into_inner`]: crate::util::PollEvented::into_inner
fn try_from(value: UnixStream) -> Result<Self, Self::Error> { fn try_from(value: UnixStream) -> Result<Self, Self::Error> {
value.io.into_inner() value.io.into_inner()
} }
+3
View File
@@ -12,6 +12,9 @@
//! //!
//! Attempting to write data that the mock isn't expected will result in a //! Attempting to write data that the mock isn't expected will result in a
//! panic. //! panic.
//!
//! [`AsyncRead`]: tokio_io::AsyncRead
//! [`AsyncWrite`]: tokio_io::AsyncWrite
use std::collections::VecDeque; use std::collections::VecDeque;
use std::future::Future; use std::future::Future;
+5 -5
View File
@@ -12,8 +12,8 @@
//! //!
//! [n]: fn.now.html //! [n]: fn.now.html
//! [`Now`]: trait.Now.html //! [`Now`]: trait.Now.html
//! [`Instant`]: https://doc.rust-lang.org/std/time/struct.Instant.html //! [`Instant`]: std::time::Instant
//! [`Instant::now`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.now //! [`Instant::now`]: std::time::Instant::now
//! [`with_default`]: fn.with_default.html //! [`with_default`]: fn.with_default.html
mod now; mod now;
@@ -31,8 +31,8 @@ use std::time::Instant;
/// `Clock` instances return [`Instant`] values corresponding to "now". The source /// `Clock` instances return [`Instant`] values corresponding to "now". The source
/// of these values is configurable. The default source is [`Instant::now`]. /// of these values is configurable. The default source is [`Instant::now`].
/// ///
/// [`Instant`]: https://doc.rust-lang.org/std/time/struct.Instant.html /// [`Instant`]: std::time::Instant
/// [`Instant::now`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.now /// [`Instant::now`]: std::time::Instant::now
#[derive(Default, Clone)] #[derive(Default, Clone)]
pub struct Clock { pub struct Clock {
now: Option<Arc<dyn Now>>, now: Option<Arc<dyn Now>>,
@@ -87,7 +87,7 @@ impl Clock {
/// Return a new `Clock` instance that uses [`Instant::now`] as the source /// Return a new `Clock` instance that uses [`Instant::now`] as the source
/// of time. /// of time.
/// ///
/// [`Instant::now`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.now /// [`Instant::now`]: std::time::Instant::now
pub fn system() -> Clock { pub fn system() -> Clock {
Clock { now: None } Clock { now: None }
} }
+1 -1
View File
@@ -8,7 +8,7 @@ use std::time::Instant;
/// Implementations must ensure that calls to `now` return monotonically /// Implementations must ensure that calls to `now` return monotonically
/// increasing [`Instant`] values. /// increasing [`Instant`] values.
/// ///
/// [`Instant`]: https://doc.rust-lang.org/std/time/struct.Instant.html /// [`Instant`]: std::time::Instant
pub trait Now: Send + Sync + 'static { pub trait Now: Send + Sync + 'static {
/// Returns an instant corresponding to "now". /// Returns an instant corresponding to "now".
fn now(&self) -> Instant; fn now(&self) -> Instant;
+2 -2
View File
@@ -31,10 +31,10 @@
//! //!
//! [`Delay`]: struct.Delay.html //! [`Delay`]: struct.Delay.html
//! [`DelayQueue`]: struct.DelayQueue.html //! [`DelayQueue`]: struct.DelayQueue.html
//! [`Throttle`]: throttle/struct.Throttle.html //! [`Throttle`]: throttle::Throttle
//! [`Timeout`]: struct.Timeout.html //! [`Timeout`]: struct.Timeout.html
//! [`Interval`]: struct.Interval.html //! [`Interval`]: struct.Interval.html
//! [`Timer`]: timer/struct.Timer.html //! [`Timer`]: timer::Timer
pub mod clock; pub mod clock;
pub mod delay_queue; pub mod delay_queue;
+1 -1
View File
@@ -108,7 +108,7 @@ impl Handle {
/// ///
/// See [type] level documentation for more ways to obtain a `Handle` value. /// See [type] level documentation for more ways to obtain a `Handle` value.
/// ///
/// [`with_default`]: ../fn.with_default.html /// [`with_default`]: fn.with_default
/// [type]: # /// [type]: #
pub fn current() -> Handle { pub fn current() -> Handle {
let private = let private =
+8 -8
View File
@@ -23,12 +23,12 @@
//! //!
//! [`Timer`]: struct.Timer.html //! [`Timer`]: struct.Timer.html
//! [`Handle`]: struct.Handle.html //! [`Handle`]: struct.Handle.html
//! [`Delay`]: ../struct.Delay.html //! [`Delay`]: Delay
//! [`Now`]: ../clock/trait.Now.html //! [`Now`]: clock::Now
//! [`Now::now`]: ../clock/trait.Now.html#method.now //! [`Now::now`]: clock::Now::now
//! [`SystemNow`]: struct.SystemNow.html //! [`SystemNow`]: struct.SystemNow.html
//! [`Instant`]: https://doc.rust-lang.org/std/time/struct.Instant.html //! [`Instant`]: std::time::Instant
//! [`Instant::now`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.now //! [`Instant::now`]: std::time::Instant::now
// This allows the usage of the old `Now` trait. // This allows the usage of the old `Now` trait.
#![allow(deprecated)] #![allow(deprecated)]
@@ -115,9 +115,9 @@ use tokio_executor::park::{Park, ParkThread, Unpark};
/// either be canceled (dropped) or their associated entries will reach level /// either be canceled (dropped) or their associated entries will reach level
/// zero and be notified. /// zero and be notified.
/// ///
/// [`Delay`]: ../struct.Delay.html /// [`Delay`]: struct.Delay.html
/// [`Interval`]: ../struct.Interval.html /// [`Interval`]: struct.Interval.html
/// [`Timeout`]: ../struct.Timeout.html /// [`Timeout`]: struct.Timeout.html
/// [paper]: http://www.cs.columbia.edu/~nahum/w6998/papers/ton97-timing-wheels.pdf /// [paper]: http://www.cs.columbia.edu/~nahum/w6998/papers/ton97-timing-wheels.pdf
/// [`handle`]: #method.handle /// [`handle`]: #method.handle
/// [`turn`]: #method.turn /// [`turn`]: #method.turn
+2 -1
View File
@@ -15,7 +15,7 @@
//! provides a few major components: //! provides a few major components:
//! //!
//! * A multi threaded, work-stealing based task [scheduler][runtime]. //! * A multi threaded, work-stealing based task [scheduler][runtime].
//! * A [reactor] backed by the operating system's event queue (epoll, kqueue, //! * A [driver] backed by the operating system's event queue (epoll, kqueue,
//! IOCP, etc...). //! IOCP, etc...).
//! * Asynchronous [TCP and UDP][net] sockets. //! * Asynchronous [TCP and UDP][net] sockets.
//! * Asynchronous [filesystem][fs] operations. //! * Asynchronous [filesystem][fs] operations.
@@ -23,6 +23,7 @@
//! //!
//! Guide level documentation is found on the [website]. //! Guide level documentation is found on the [website].
//! //!
//! [driver]: tokio_net::driver
//! [website]: https://tokio.rs/docs/ //! [website]: https://tokio.rs/docs/
//! //!
//! # Examples //! # Examples
-6
View File
@@ -50,14 +50,8 @@ pub mod udp {
//! UDP bindings for `tokio`. //! UDP bindings for `tokio`.
//! //!
//! The main struct for UDP is the [`UdpSocket`], which represents a UDP socket. //! The main struct for UDP is the [`UdpSocket`], which represents a UDP socket.
//! Reading and writing to it can be done using futures, which return the
//! [`Recv`], [`Send`], [`RecvFrom`], [`SendTo`] structs respectively.
//! //!
//! [`UdpSocket`]: struct.UdpSocket.html //! [`UdpSocket`]: struct.UdpSocket.html
//! [`Recv`]: struct.Recv.html
//! [`Send`]: struct.Send.html
//! [`RecvFrom`]: struct.RecvFrom.html
//! [`SendTo`]: struct.SendTo.html
pub use tokio_net::udp::{split, UdpFramed, UdpSocket}; pub use tokio_net::udp::{split, UdpFramed, UdpSocket};
} }
#[cfg(feature = "udp")] #[cfg(feature = "udp")]
+3 -2
View File
@@ -2,7 +2,7 @@
//! //!
//! Applications using Tokio require some runtime support in order to work: //! Applications using Tokio require some runtime support in order to work:
//! //!
//! * A [reactor] to drive I/O resources. //! * A [driver] to drive I/O resources.
//! * An [executor] to execute tasks that use these I/O resources. //! * An [executor] to execute tasks that use these I/O resources.
//! * A [timer] for scheduling work to run after a set period of time. //! * A [timer] for scheduling work to run after a set period of time.
//! //!
@@ -128,7 +128,7 @@
//! } //! }
//! ``` //! ```
//! //!
//! [reactor]: ../reactor/struct.Reactor.html //! [driver]: tokio_net::driver
//! [executor]: https://tokio.rs/docs/internals/runtime-model/#executors //! [executor]: https://tokio.rs/docs/internals/runtime-model/#executors
//! [timer]: ../timer/index.html //! [timer]: ../timer/index.html
//! [`Runtime`]: struct.Runtime.html //! [`Runtime`]: struct.Runtime.html
@@ -138,6 +138,7 @@
//! [idle]: struct.Runtime.html#method.shutdown_on_idle //! [idle]: struct.Runtime.html#method.shutdown_on_idle
//! [`tokio::spawn`]: ../executor/fn.spawn.html //! [`tokio::spawn`]: ../executor/fn.spawn.html
//! [`Timer`]: https://docs.rs/tokio-timer/0.2/tokio_timer/timer/struct.Timer.html //! [`Timer`]: https://docs.rs/tokio-timer/0.2/tokio_timer/timer/struct.Timer.html
//! [`tokio::main`]: ../../tokio_macros/attr.main.html
pub mod current_thread; pub mod current_thread;
mod threadpool; mod threadpool;
+2 -1
View File
@@ -23,7 +23,8 @@ pub use futures_util::stream::{empty, iter, once, pending, poll_fn, repeat, unfo
/// This trait can be imported directly or via the Tokio prelude: `use /// This trait can be imported directly or via the Tokio prelude: `use
/// tokio::prelude::*`. /// tokio::prelude::*`.
/// ///
/// [`timeout`]: #method.timeout /// [`throttle`]: method.throttle
/// [`timeout`]: method.timeout
pub trait StreamExt: Stream { pub trait StreamExt: Stream {
/// Throttle down the stream by enforcing a fixed delay between items. /// Throttle down the stream by enforcing a fixed delay between items.
/// ///