Skip to content

Commit 9caf86c

Browse files
committed
mark stdio-lock structs as unstable
Signed-off-by: Yoshua Wuyts <[email protected]>
1 parent 4c63392 commit 9caf86c

File tree

4 files changed

+31
-8
lines changed

4 files changed

+31
-8
lines changed

src/io/mod.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ pub use read::Read;
282282
pub use repeat::{repeat, Repeat};
283283
pub use seek::Seek;
284284
pub use sink::{sink, Sink};
285-
pub use stderr::{stderr, Stderr, StderrLock};
286-
pub use stdin::{stdin, Stdin, StdinLock};
287-
pub use stdout::{stdout, Stdout, StdoutLock};
285+
pub use stderr::{stderr, Stderr};
286+
pub use stdin::{stdin, Stdin};
287+
pub use stdout::{stdout, Stdout};
288288
pub use timeout::timeout;
289289
pub use write::Write;
290290

@@ -311,3 +311,9 @@ mod stdin;
311311
mod stdio;
312312
mod stdout;
313313
mod timeout;
314+
315+
cfg_unstable! {
316+
pub use stderr::StderrLock;
317+
pub use stdin::StdinLock;
318+
pub use stdout::StdoutLock;
319+
}

src/io/stderr.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::io::Write as StdWrite;
21
use std::pin::Pin;
32
use std::sync::Mutex;
43

@@ -8,6 +7,7 @@ use crate::task::{spawn_blocking, Context, JoinHandle, Poll};
87

98
cfg_unstable! {
109
use once_cell::sync::Lazy;
10+
use std::io::Write as _;
1111
}
1212

1313
/// Constructs a new handle to the standard error of the current process.
@@ -63,9 +63,13 @@ pub struct Stderr(Mutex<State>);
6363
///
6464
/// [`Write`]: trait.Read.html
6565
/// [`Stderr::lock`]: struct.Stderr.html#method.lock
66+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
67+
#[cfg(any(feature = "unstable", feature = "docs"))]
6668
#[derive(Debug)]
6769
pub struct StderrLock<'a>(std::io::StderrLock<'a>);
6870

71+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
72+
#[cfg(any(feature = "unstable", feature = "docs"))]
6973
unsafe impl Send for StderrLock<'_> {}
7074

7175
/// The state of the asynchronous stderr.
@@ -234,7 +238,9 @@ cfg_windows! {
234238
}
235239
}
236240

237-
impl Write for StderrLock<'_> {
241+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
242+
#[cfg(any(feature = "unstable", feature = "docs"))]
243+
impl io::Write for StderrLock<'_> {
238244
fn poll_write(
239245
mut self: Pin<&mut Self>,
240246
_cx: &mut Context<'_>,

src/io/stdin.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::task::{spawn_blocking, Context, JoinHandle, Poll};
77

88
cfg_unstable! {
99
use once_cell::sync::Lazy;
10+
use std::io::Read as _;
1011
}
1112

1213
/// Constructs a new handle to the standard input of the current process.
@@ -63,9 +64,13 @@ pub struct Stdin(Mutex<State>);
6364
///
6465
/// [`Read`]: trait.Read.html
6566
/// [`Stdin::lock`]: struct.Stdin.html#method.lock
67+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
68+
#[cfg(any(feature = "unstable", feature = "docs"))]
6669
#[derive(Debug)]
6770
pub struct StdinLock<'a>(std::io::StdinLock<'a>);
6871

72+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
73+
#[cfg(any(feature = "unstable", feature = "docs"))]
6974
unsafe impl Send for StdinLock<'_> {}
7075

7176
/// The state of the asynchronous stdin.
@@ -257,14 +262,14 @@ cfg_windows! {
257262
}
258263
}
259264

265+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
266+
#[cfg(any(feature = "unstable", feature = "docs"))]
260267
impl Read for StdinLock<'_> {
261268
fn poll_read(
262269
mut self: Pin<&mut Self>,
263270
_cx: &mut Context<'_>,
264271
buf: &mut [u8],
265272
) -> Poll<io::Result<usize>> {
266-
use std::io::Read as StdRead;
267-
268273
Poll::Ready(self.0.read(buf))
269274
}
270275
}

src/io/stdout.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::io::Write as StdWrite;
21
use std::pin::Pin;
32
use std::sync::Mutex;
43

@@ -8,6 +7,7 @@ use crate::task::{spawn_blocking, Context, JoinHandle, Poll};
87

98
cfg_unstable! {
109
use once_cell::sync::Lazy;
10+
use std::io::Write as _;
1111
}
1212

1313
/// Constructs a new handle to the standard output of the current process.
@@ -63,9 +63,13 @@ pub struct Stdout(Mutex<State>);
6363
///
6464
/// [`Write`]: trait.Read.html
6565
/// [`Stdout::lock`]: struct.Stdout.html#method.lock
66+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
67+
#[cfg(any(feature = "unstable", feature = "docs"))]
6668
#[derive(Debug)]
6769
pub struct StdoutLock<'a>(std::io::StdoutLock<'a>);
6870

71+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
72+
#[cfg(any(feature = "unstable", feature = "docs"))]
6973
unsafe impl Send for StdoutLock<'_> {}
7074

7175
/// The state of the asynchronous stdout.
@@ -234,6 +238,8 @@ cfg_windows! {
234238
}
235239
}
236240

241+
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
242+
#[cfg(any(feature = "unstable", feature = "docs"))]
237243
impl Write for StdoutLock<'_> {
238244
fn poll_write(
239245
mut self: Pin<&mut Self>,

0 commit comments

Comments
 (0)