mark stdio-lock structs as unstable

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
poc-serde-support
Yoshua Wuyts 5 years ago
parent 4c63392a85
commit 6f9436e575
No known key found for this signature in database
GPG Key ID: 24EA8164F96777ED

@ -282,9 +282,9 @@ pub use read::Read;
pub use repeat::{repeat, Repeat}; pub use repeat::{repeat, Repeat};
pub use seek::Seek; pub use seek::Seek;
pub use sink::{sink, Sink}; pub use sink::{sink, Sink};
pub use stderr::{stderr, Stderr, StderrLock}; pub use stderr::{stderr, Stderr};
pub use stdin::{stdin, Stdin, StdinLock}; pub use stdin::{stdin, Stdin};
pub use stdout::{stdout, Stdout, StdoutLock}; pub use stdout::{stdout, Stdout};
pub use timeout::timeout; pub use timeout::timeout;
pub use write::Write; pub use write::Write;
@ -311,3 +311,9 @@ mod stdin;
mod stdio; mod stdio;
mod stdout; mod stdout;
mod timeout; mod timeout;
cfg_unstable! {
pub use stderr::StderrLock;
pub use stdin::StdinLock;
pub use stdout::StdoutLock;
}

@ -1,4 +1,3 @@
use std::io::Write as StdWrite;
use std::pin::Pin; use std::pin::Pin;
use std::sync::Mutex; use std::sync::Mutex;
@ -8,6 +7,7 @@ use crate::task::{spawn_blocking, Context, JoinHandle, Poll};
cfg_unstable! { cfg_unstable! {
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use std::io::Write as _;
} }
/// Constructs a new handle to the standard error of the current process. /// Constructs a new handle to the standard error of the current process.
@ -59,13 +59,19 @@ pub fn stderr() -> Stderr {
pub struct Stderr(Mutex<State>); pub struct Stderr(Mutex<State>);
/// A locked reference to the Stderr handle. /// A locked reference to the Stderr handle.
/// This handle implements the [`Write`] traits, and is constructed via the [`Stderr::lock`] method. ///
/// This handle implements the [`Write`] traits, and is constructed via the [`Stderr::lock`]
/// method.
/// ///
/// [`Write`]: trait.Read.html /// [`Write`]: trait.Read.html
/// [`Stderr::lock`]: struct.Stderr.html#method.lock /// [`Stderr::lock`]: struct.Stderr.html#method.lock
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
#[derive(Debug)] #[derive(Debug)]
pub struct StderrLock<'a>(std::io::StderrLock<'a>); pub struct StderrLock<'a>(std::io::StderrLock<'a>);
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
unsafe impl Send for StderrLock<'_> {} unsafe impl Send for StderrLock<'_> {}
/// The state of the asynchronous stderr. /// The state of the asynchronous stderr.
@ -234,7 +240,9 @@ cfg_windows! {
} }
} }
impl Write for StderrLock<'_> { #[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
impl io::Write for StderrLock<'_> {
fn poll_write( fn poll_write(
mut self: Pin<&mut Self>, mut self: Pin<&mut Self>,
_cx: &mut Context<'_>, _cx: &mut Context<'_>,

@ -7,6 +7,7 @@ use crate::task::{spawn_blocking, Context, JoinHandle, Poll};
cfg_unstable! { cfg_unstable! {
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use std::io::Read as _;
} }
/// Constructs a new handle to the standard input of the current process. /// Constructs a new handle to the standard input of the current process.
@ -59,13 +60,18 @@ pub fn stdin() -> Stdin {
pub struct Stdin(Mutex<State>); pub struct Stdin(Mutex<State>);
/// A locked reference to the Stdin handle. /// A locked reference to the Stdin handle.
///
/// This handle implements the [`Read`] traits, and is constructed via the [`Stdin::lock`] method. /// This handle implements the [`Read`] traits, and is constructed via the [`Stdin::lock`] method.
/// ///
/// [`Read`]: trait.Read.html /// [`Read`]: trait.Read.html
/// [`Stdin::lock`]: struct.Stdin.html#method.lock /// [`Stdin::lock`]: struct.Stdin.html#method.lock
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
#[cfg(feature = "unstable")]
#[derive(Debug)] #[derive(Debug)]
pub struct StdinLock<'a>(std::io::StdinLock<'a>); pub struct StdinLock<'a>(std::io::StdinLock<'a>);
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
unsafe impl Send for StdinLock<'_> {} unsafe impl Send for StdinLock<'_> {}
/// The state of the asynchronous stdin. /// The state of the asynchronous stdin.
@ -257,14 +263,14 @@ cfg_windows! {
} }
} }
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
impl Read for StdinLock<'_> { impl Read for StdinLock<'_> {
fn poll_read( fn poll_read(
mut self: Pin<&mut Self>, mut self: Pin<&mut Self>,
_cx: &mut Context<'_>, _cx: &mut Context<'_>,
buf: &mut [u8], buf: &mut [u8],
) -> Poll<io::Result<usize>> { ) -> Poll<io::Result<usize>> {
use std::io::Read as StdRead;
Poll::Ready(self.0.read(buf)) Poll::Ready(self.0.read(buf))
} }
} }

@ -1,4 +1,3 @@
use std::io::Write as StdWrite;
use std::pin::Pin; use std::pin::Pin;
use std::sync::Mutex; use std::sync::Mutex;
@ -8,6 +7,7 @@ use crate::task::{spawn_blocking, Context, JoinHandle, Poll};
cfg_unstable! { cfg_unstable! {
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use std::io::Write as _;
} }
/// Constructs a new handle to the standard output of the current process. /// Constructs a new handle to the standard output of the current process.
@ -59,13 +59,19 @@ pub fn stdout() -> Stdout {
pub struct Stdout(Mutex<State>); pub struct Stdout(Mutex<State>);
/// A locked reference to the Stderr handle. /// A locked reference to the Stderr handle.
/// This handle implements the [`Write`] traits, and is constructed via the [`Stdout::lock`] method. ///
/// This handle implements the [`Write`] traits, and is constructed via the [`Stdout::lock`]
/// method.
/// ///
/// [`Write`]: trait.Read.html /// [`Write`]: trait.Read.html
/// [`Stdout::lock`]: struct.Stdout.html#method.lock /// [`Stdout::lock`]: struct.Stdout.html#method.lock
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
#[derive(Debug)] #[derive(Debug)]
pub struct StdoutLock<'a>(std::io::StdoutLock<'a>); pub struct StdoutLock<'a>(std::io::StdoutLock<'a>);
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
unsafe impl Send for StdoutLock<'_> {} unsafe impl Send for StdoutLock<'_> {}
/// The state of the asynchronous stdout. /// The state of the asynchronous stdout.
@ -234,6 +240,8 @@ cfg_windows! {
} }
} }
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
impl Write for StdoutLock<'_> { impl Write for StdoutLock<'_> {
fn poll_write( fn poll_write(
mut self: Pin<&mut Self>, mut self: Pin<&mut Self>,

Loading…
Cancel
Save