mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
doc: fix doc-cfg on io::duplex, io::copy_bidirectional, and task::unconstrained (#3773)
This commit is contained in:
parent
7207e3ca43
commit
8324317005
@ -104,6 +104,7 @@ where
|
|||||||
/// # Return value
|
/// # Return value
|
||||||
///
|
///
|
||||||
/// Returns a tuple of bytes copied `a` to `b` and bytes copied `b` to `a`.
|
/// Returns a tuple of bytes copied `a` to `b` and bytes copied `b` to `a`.
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "io-util")))]
|
||||||
pub async fn copy_bidirectional<A, B>(a: &mut A, b: &mut B) -> Result<(u64, u64), std::io::Error>
|
pub async fn copy_bidirectional<A, B>(a: &mut A, b: &mut B) -> Result<(u64, u64), std::io::Error>
|
||||||
where
|
where
|
||||||
A: AsyncRead + AsyncWrite + Unpin + ?Sized,
|
A: AsyncRead + AsyncWrite + Unpin + ?Sized,
|
||||||
|
@ -45,6 +45,7 @@ use std::{
|
|||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "io-util")))]
|
||||||
pub struct DuplexStream {
|
pub struct DuplexStream {
|
||||||
read: Arc<Mutex<Pipe>>,
|
read: Arc<Mutex<Pipe>>,
|
||||||
write: Arc<Mutex<Pipe>>,
|
write: Arc<Mutex<Pipe>>,
|
||||||
@ -80,6 +81,7 @@ struct Pipe {
|
|||||||
///
|
///
|
||||||
/// The `max_buf_size` argument is the maximum amount of bytes that can be
|
/// The `max_buf_size` argument is the maximum amount of bytes that can be
|
||||||
/// written to a side before the write returns `Poll::Pending`.
|
/// written to a side before the write returns `Poll::Pending`.
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "io-util")))]
|
||||||
pub fn duplex(max_buf_size: usize) -> (DuplexStream, DuplexStream) {
|
pub fn duplex(max_buf_size: usize) -> (DuplexStream, DuplexStream) {
|
||||||
let one = Arc::new(Mutex::new(Pipe::new(max_buf_size)));
|
let one = Arc::new(Mutex::new(Pipe::new(max_buf_size)));
|
||||||
let two = Arc::new(Mutex::new(Pipe::new(max_buf_size)));
|
let two = Arc::new(Mutex::new(Pipe::new(max_buf_size)));
|
||||||
|
@ -5,6 +5,7 @@ use std::task::{Context, Poll};
|
|||||||
|
|
||||||
pin_project! {
|
pin_project! {
|
||||||
/// Future for the [`unconstrained`](unconstrained) method.
|
/// Future for the [`unconstrained`](unconstrained) method.
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "rt")))]
|
||||||
#[must_use = "Unconstrained does nothing unless polled"]
|
#[must_use = "Unconstrained does nothing unless polled"]
|
||||||
pub struct Unconstrained<F> {
|
pub struct Unconstrained<F> {
|
||||||
#[pin]
|
#[pin]
|
||||||
@ -38,6 +39,7 @@ where
|
|||||||
/// otherwise.
|
/// otherwise.
|
||||||
///
|
///
|
||||||
/// See also the usage example in the [task module](index.html#unconstrained).
|
/// See also the usage example in the [task module](index.html#unconstrained).
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "rt")))]
|
||||||
pub fn unconstrained<F>(inner: F) -> Unconstrained<F> {
|
pub fn unconstrained<F>(inner: F) -> Unconstrained<F> {
|
||||||
Unconstrained { inner }
|
Unconstrained { inner }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user