1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*!
Buffered + locked stdio helpers.
This module provides `BufWriter`-wrapped `stdout`/`stderr` handles that are
also *locked*, which is a common pattern for high-throughput output:
- `StdoutLock`/`StderrLock` avoids re-locking the global stdio handle on
every write.
- `BufWriter` batches many small writes into fewer syscalls.
## Notes
- The returned writers are **buffered**: output may not appear immediately.
Call [`.flush()`](std::io::Write::flush) when you need timely output
(e.g., prompts/progress).
- The underlying lock is held for as long as the writer value is alive. Keep
the lifetime short if other threads also write to stdio.
*/
// ===========================
use ;
/// A buffered, locked handle to standard output.
///
/// Uses `StdoutLock<'static>` because `stdout()` is backed by a global,
/// process-wide handle; the lock guard itself is still released on `Drop`.
pub type BufStdout = ;
/// A buffered, locked handle to standard error.
///
/// Like `BufStdout`, this holds a lock guard for the lifetime of the value
/// and buffers writes until the buffer is flushed/dropped.
pub type BufStderr = ;
/// Creates a buffered, locked `stdout` writer.
///
/// Prefer this in tight loops or when emitting lots of output, where repeated
/// `println!` calls would otherwise lock and write frequently.
/// Creates a buffered, locked `stderr` writer.
///
/// Useful for high-volume diagnostics or logging to stderr with fewer
/// syscalls.