Enable documentation for optional features on docs.rs

This commit is contained in:
Tim Kuehn
2020-08-02 20:57:21 -07:00
parent 240c436b34
commit f65dd05949
5 changed files with 11 additions and 9 deletions

View File

@@ -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<Self> {
#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<S> {
service: S,

View File

@@ -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::*;

View File

@@ -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<S>(self, server: S) -> Running<Self, S>
where
S: Serve<C::Req, Resp = C::Resp>,
@@ -654,7 +655,7 @@ where
S: Serve<C::Req, Resp = C::Resp> + 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<St, Se> {
}
#[cfg(feature = "tokio1")]
#[cfg_attr(docsrs, doc(cfg(feature = "tokio1")))]
impl<St, C, Se> Future for Running<St, Se>
where
St: Sized + Stream<Item = C>,

View File

@@ -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::*;

View File

@@ -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<S, Item, SinkItem, Codec> {
#[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<Item, SinkItem, Codec, CodecFn> {