diff --git a/plugins/src/lib.rs b/plugins/src/lib.rs index 4c89de0..d290c55 100644 --- a/plugins/src/lib.rs +++ b/plugins/src/lib.rs @@ -523,7 +523,7 @@ impl<'a> ServiceGenerator<'a> { #vis trait #service_ident: Clone { #( #types_and_fns )* - /// Returns a serving function to use with tarpc::server::Server. + /// Returns a serving function to use with [tarpc::server::Channel::respond_with]. fn serve(self) -> #server_ident { #server_ident { service: self } } @@ -537,6 +537,7 @@ impl<'a> ServiceGenerator<'a> { } = self; quote! { + /// A serving function to use with [tarpc::server::Channel::respond_with]. #[derive(Clone)] #vis struct #server_ident { service: S, diff --git a/tarpc/src/lib.rs b/tarpc/src/lib.rs index 2df16fc..bea2d52 100644 --- a/tarpc/src/lib.rs +++ b/tarpc/src/lib.rs @@ -201,6 +201,7 @@ //! items expanded by a `service!` invocation. #![deny(missing_docs)] #![allow(clippy::type_complexity)] +#![cfg_attr(docsrs, feature(doc_cfg))] pub mod rpc; pub use rpc::*; diff --git a/tarpc/src/rpc/server/mod.rs b/tarpc/src/rpc/server/mod.rs index 334114f..0481052 100644 --- a/tarpc/src/rpc/server/mod.rs +++ b/tarpc/src/rpc/server/mod.rs @@ -144,8 +144,9 @@ where ThrottlerStream::new(self, n) } - /// Responds to all requests with `server`. + /// Responds to all requests with [`server::serve`](Serve). #[cfg(feature = "tokio1")] + #[cfg_attr(docsrs, doc(cfg(feature = "tokio1")))] fn respond_with(self, server: S) -> Running where S: Serve, @@ -654,7 +655,7 @@ where S: Serve + Send + 'static, S::Fut: Send + 'static, { - /// Runs the client handler until completion by spawning each + /// Runs the client handler until completion by [spawning](tokio::spawn) each /// request handler onto the default executor. #[cfg(feature = "tokio1")] #[cfg_attr(docsrs, doc(cfg(feature = "tokio1")))] @@ -668,7 +669,7 @@ where } } -/// A future that drives the server by spawning channels and request handlers on the default +/// A future that drives the server by [spawning](tokio::spawn) channels and request handlers on the default /// executor. #[pin_project] #[derive(Debug)] @@ -681,7 +682,6 @@ pub struct Running { } #[cfg(feature = "tokio1")] -#[cfg_attr(docsrs, doc(cfg(feature = "tokio1")))] impl Future for Running where St: Sized + Stream, diff --git a/tarpc/src/rpc/transport/mod.rs b/tarpc/src/rpc/transport/mod.rs index 911f955..3a38f6c 100644 --- a/tarpc/src/rpc/transport/mod.rs +++ b/tarpc/src/rpc/transport/mod.rs @@ -4,9 +4,9 @@ // license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. -//! Provides a [`Transport`] trait as well as implementations. +//! Provides a [`Transport`](sealed::Transport) trait as well as implementations. //! -//! The rpc crate is transport- and protocol-agnostic. Any transport that impls [`Transport`] +//! The rpc crate is transport- and protocol-agnostic. Any transport that impls [`Transport`](sealed::Transport) //! can be plugged in, using whatever protocol it wants. use futures::prelude::*; diff --git a/tarpc/src/serde_transport/mod.rs b/tarpc/src/serde_transport/mod.rs index 3762199..e872740 100644 --- a/tarpc/src/serde_transport/mod.rs +++ b/tarpc/src/serde_transport/mod.rs @@ -16,7 +16,7 @@ use tokio::io::{AsyncRead, AsyncWrite}; use tokio_serde::{Framed as SerdeFramed, *}; use tokio_util::codec::{length_delimited::LengthDelimitedCodec, Framed}; -/// A transport that serializes to, and deserializes from, a [`TcpStream`]. +/// A transport that serializes to, and deserializes from, a byte stream. #[pin_project] pub struct Transport { #[pin] @@ -182,7 +182,7 @@ pub mod tcp { }) } - /// A [`TcpListener`] that wraps connections in JSON transports. + /// A [`TcpListener`] that wraps connections in [transports](Transport). #[pin_project] #[derive(Debug)] pub struct Incoming {