Skip to content

Commit f31d818

Browse files
committed
Rollup merge of rust-lang#23379 - kballard:tweak-stdio-docs-no-raw-constructors, r=alexcrichton
`std::io` does not currently expose the `stdin_raw`, `stdout_raw`, or `stderr_raw` functions. According to the current plans for stdio (see rust-lang/rfcs#517), raw access will likely be provided using the platform-specific `std::os::{unix,windows}` modules. At the moment we don't expose any way to do this. As such, delete all mention of the `*_raw` functions from the `stdin`/`stdout`/`stderr` function documentation. While we're at it, remove a few `pub`s from items that aren't exposed. This is done just to lessen the confusion experienced by anyone who looks at the source in an attempt to find the `*_raw` functions.
2 parents 3ebe249 + 3453b5b commit f31d818

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

src/libstd/io/stdio.rs

+9-18
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ use sys::stdio;
2121
/// A handle to a raw instance of the standard input stream of this process.
2222
///
2323
/// This handle is not synchronized or buffered in any fashion. Constructed via
24-
/// the `std::io::stdin_raw` function.
25-
pub struct StdinRaw(stdio::Stdin);
24+
/// the `std::io::stdio::stdin_raw` function.
25+
struct StdinRaw(stdio::Stdin);
2626

2727
/// A handle to a raw instance of the standard output stream of this process.
2828
///
2929
/// This handle is not synchronized or buffered in any fashion. Constructed via
30-
/// the `std::io::stdout_raw` function.
31-
pub struct StdoutRaw(stdio::Stdout);
30+
/// the `std::io::stdio::stdout_raw` function.
31+
struct StdoutRaw(stdio::Stdout);
3232

3333
/// A handle to a raw instance of the standard output stream of this process.
3434
///
3535
/// This handle is not synchronized or buffered in any fashion. Constructed via
36-
/// the `std::io::stderr_raw` function.
37-
pub struct StderrRaw(stdio::Stderr);
36+
/// the `std::io::stdio::stderr_raw` function.
37+
struct StderrRaw(stdio::Stderr);
3838

3939
/// Construct a new raw handle to the standard input of this process.
4040
///
@@ -43,7 +43,7 @@ pub struct StderrRaw(stdio::Stderr);
4343
/// handles is **not** available to raw handles returned from this function.
4444
///
4545
/// The returned handle has no external synchronization or buffering.
46-
pub fn stdin_raw() -> StdinRaw { StdinRaw(stdio::Stdin::new()) }
46+
fn stdin_raw() -> StdinRaw { StdinRaw(stdio::Stdin::new()) }
4747

4848
/// Construct a new raw handle to the standard input stream of this process.
4949
///
@@ -54,7 +54,7 @@ pub fn stdin_raw() -> StdinRaw { StdinRaw(stdio::Stdin::new()) }
5454
///
5555
/// The returned handle has no external synchronization or buffering layered on
5656
/// top.
57-
pub fn stdout_raw() -> StdoutRaw { StdoutRaw(stdio::Stdout::new()) }
57+
fn stdout_raw() -> StdoutRaw { StdoutRaw(stdio::Stdout::new()) }
5858

5959
/// Construct a new raw handle to the standard input stream of this process.
6060
///
@@ -63,7 +63,7 @@ pub fn stdout_raw() -> StdoutRaw { StdoutRaw(stdio::Stdout::new()) }
6363
///
6464
/// The returned handle has no external synchronization or buffering layered on
6565
/// top.
66-
pub fn stderr_raw() -> StderrRaw { StderrRaw(stdio::Stderr::new()) }
66+
fn stderr_raw() -> StderrRaw { StderrRaw(stdio::Stderr::new()) }
6767

6868
impl Read for StdinRaw {
6969
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { self.0.read(buf) }
@@ -109,9 +109,6 @@ pub struct StdinLock<'a> {
109109
/// The `Read` trait is implemented for the returned value but the `BufRead`
110110
/// trait is not due to the global nature of the standard input stream. The
111111
/// locked version, `StdinLock`, implements both `Read` and `BufRead`, however.
112-
///
113-
/// To avoid locking and buffering altogether, it is recommended to use the
114-
/// `stdin_raw` constructor.
115112
#[stable(feature = "rust1", since = "1.0.0")]
116113
pub fn stdin() -> Stdin {
117114
static INSTANCE: Lazy<Mutex<BufReader<StdinRaw>>> = lazy_init!(stdin_init);
@@ -224,9 +221,6 @@ pub struct StdoutLock<'a> {
224221
/// provided via the `lock` method.
225222
///
226223
/// The returned handle implements the `Write` trait.
227-
///
228-
/// To avoid locking and buffering altogether, it is recommended to use the
229-
/// `stdout_raw` constructor.
230224
#[stable(feature = "rust1", since = "1.0.0")]
231225
pub fn stdout() -> Stdout {
232226
static INSTANCE: Lazy<Mutex<LineWriter<StdoutRaw>>> = lazy_init!(stdout_init);
@@ -297,9 +291,6 @@ pub struct StderrLock<'a> {
297291
/// this function. No handles are buffered, however.
298292
///
299293
/// The returned handle implements the `Write` trait.
300-
///
301-
/// To avoid locking altogether, it is recommended to use the `stderr_raw`
302-
/// constructor.
303294
#[stable(feature = "rust1", since = "1.0.0")]
304295
pub fn stderr() -> Stderr {
305296
static INSTANCE: Lazy<Mutex<StderrRaw>> = lazy_init!(stderr_init);

0 commit comments

Comments
 (0)