Skip to content

Commit 23b7c17

Browse files
committed
feat: Stabilize io::Std*Lock
1 parent 9167d42 commit 23b7c17

File tree

4 files changed

+9
-45
lines changed

4 files changed

+9
-45
lines changed

src/io/mod.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ cfg_default! {
309309
#[doc(hidden)]
310310
pub use stdio::{_eprint, _print};
311311

312-
pub use stderr::{stderr, Stderr};
313-
pub use stdin::{stdin, Stdin};
314-
pub use stdout::{stdout, Stdout};
312+
pub use stderr::{stderr, Stderr, StderrLock};
313+
pub use stdin::{stdin, Stdin, StdinLock};
314+
pub use stdout::{stdout, Stdout, StdoutLock};
315315
pub use timeout::timeout;
316316

317317
mod timeout;
@@ -320,9 +320,3 @@ cfg_default! {
320320
mod stdio;
321321
mod stdout;
322322
}
323-
324-
cfg_unstable_default! {
325-
pub use stderr::StderrLock;
326-
pub use stdin::StdinLock;
327-
pub use stdout::StdoutLock;
328-
}

src/io/stderr.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
use std::pin::Pin;
22
use std::sync::Mutex;
33
use std::future::Future;
4+
use std::io::Write as _;
45

56
use crate::io::{self, Write};
67
use crate::task::{spawn_blocking, Context, JoinHandle, Poll};
78

8-
cfg_unstable! {
9-
use once_cell::sync::Lazy;
10-
use std::io::Write as _;
11-
}
9+
use once_cell::sync::Lazy;
1210

1311
/// Constructs a new handle to the standard error of the current process.
1412
///
@@ -65,13 +63,9 @@ pub struct Stderr(Mutex<State>);
6563
///
6664
/// [`Write`]: trait.Read.html
6765
/// [`Stderr::lock`]: struct.Stderr.html#method.lock
68-
#[cfg(feature = "unstable")]
69-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
7066
#[derive(Debug)]
7167
pub struct StderrLock<'a>(std::io::StderrLock<'a>);
7268

73-
#[cfg(feature = "unstable")]
74-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
7569
unsafe impl Send for StderrLock<'_> {}
7670

7771
/// The state of the asynchronous stderr.
@@ -128,8 +122,6 @@ impl Stderr {
128122
/// #
129123
/// # Ok(()) }) }
130124
/// ```
131-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
132-
#[cfg(any(feature = "unstable", feature = "docs"))]
133125
pub async fn lock(&self) -> StderrLock<'static> {
134126
static STDERR: Lazy<std::io::Stderr> = Lazy::new(std::io::stderr);
135127

@@ -240,8 +232,6 @@ cfg_windows! {
240232
}
241233
}
242234

243-
#[cfg(feature = "unstable")]
244-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
245235
impl io::Write for StderrLock<'_> {
246236
fn poll_write(
247237
mut self: Pin<&mut Self>,

src/io/stdin.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
use std::future::Future;
22
use std::pin::Pin;
33
use std::sync::Mutex;
4+
use std::io::Read as _;
45

56
use crate::future;
67
use crate::io::{self, Read};
78
use crate::task::{spawn_blocking, Context, JoinHandle, Poll};
89
use crate::utils::Context as _;
910

10-
cfg_unstable! {
11-
use once_cell::sync::Lazy;
12-
use std::io::Read as _;
13-
}
11+
use once_cell::sync::Lazy;
1412

1513
/// Constructs a new handle to the standard input of the current process.
1614
///
@@ -67,13 +65,9 @@ pub struct Stdin(Mutex<State>);
6765
///
6866
/// [`Read`]: trait.Read.html
6967
/// [`Stdin::lock`]: struct.Stdin.html#method.lock
70-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
71-
#[cfg(feature = "unstable")]
7268
#[derive(Debug)]
7369
pub struct StdinLock<'a>(std::io::StdinLock<'a>);
7470

75-
#[cfg(feature = "unstable")]
76-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
7771
unsafe impl Send for StdinLock<'_> {}
7872

7973
/// The state of the asynchronous stdin.
@@ -187,8 +181,6 @@ impl Stdin {
187181
/// #
188182
/// # Ok(()) }) }
189183
/// ```
190-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
191-
#[cfg(any(feature = "unstable", feature = "docs"))]
192184
pub async fn lock(&self) -> StdinLock<'static> {
193185
static STDIN: Lazy<std::io::Stdin> = Lazy::new(std::io::stdin);
194186

@@ -266,8 +258,6 @@ cfg_windows! {
266258
}
267259
}
268260

269-
#[cfg(feature = "unstable")]
270-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
271261
impl Read for StdinLock<'_> {
272262
fn poll_read(
273263
mut self: Pin<&mut Self>,

src/io/stdout.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
use std::pin::Pin;
22
use std::sync::Mutex;
33
use std::future::Future;
4+
use std::io::Write as _;
45

56
use crate::io::{self, Write};
67
use crate::task::{spawn_blocking, Context, JoinHandle, Poll};
78

8-
cfg_unstable! {
9-
use once_cell::sync::Lazy;
10-
use std::io::Write as _;
11-
}
9+
use once_cell::sync::Lazy;
1210

1311
/// Constructs a new handle to the standard output of the current process.
1412
///
@@ -65,13 +63,9 @@ pub struct Stdout(Mutex<State>);
6563
///
6664
/// [`Write`]: trait.Read.html
6765
/// [`Stdout::lock`]: struct.Stdout.html#method.lock
68-
#[cfg(feature = "unstable")]
69-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
7066
#[derive(Debug)]
7167
pub struct StdoutLock<'a>(std::io::StdoutLock<'a>);
7268

73-
#[cfg(feature = "unstable")]
74-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
7569
unsafe impl Send for StdoutLock<'_> {}
7670

7771
/// The state of the asynchronous stdout.
@@ -128,8 +122,6 @@ impl Stdout {
128122
/// #
129123
/// # Ok(()) }) }
130124
/// ```
131-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
132-
#[cfg(any(feature = "unstable", feature = "docs"))]
133125
pub async fn lock(&self) -> StdoutLock<'static> {
134126
static STDOUT: Lazy<std::io::Stdout> = Lazy::new(std::io::stdout);
135127

@@ -240,8 +232,6 @@ cfg_windows! {
240232
}
241233
}
242234

243-
#[cfg(feature = "unstable")]
244-
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
245235
impl Write for StdoutLock<'_> {
246236
fn poll_write(
247237
mut self: Pin<&mut Self>,

0 commit comments

Comments
 (0)