Expand description
Auto-adapting stdout / stderr streams
AutoStream always accepts ANSI escape codes,
adapting to the user’s terminal’s capabilities.
Benefits
- Allows the caller to not be concerned with the terminal’s capabilities
- Semver safe way of passing styled text between crates as ANSI escape codes offer more compatibility than most crate APIs.
§Example
use anstyle_stream::println;
use owo_colors::OwoColorize as _;
// Foreground colors
println!("My number is {:#x}!", 10.green());
// Background colors
println!("My number is not {}!", 4.on_red());And this will correctly handle piping to a file, etc
Modules§
- adapter
- Gracefully degrade styled output
Macros§
- eprint
auto - Prints to
stderr. - eprintln
auto - Prints to
stderr, with a newline. - panic
auto - Panics the current thread.
- print
auto - Prints to
stdout. - println
auto - Prints to
stdout, with a newline.
Structs§
- Auto
Stream std::io::Writethat adapts ANSI escape codes to the underlyingWrites capabilities- Buffer
- In-memory
RawStream - Strip
Stream - Only pass printable data to the inner
Write
Enums§
- Color
Choice auto - Selection for overriding color output with
force_colorSelection for overriding color output
Traits§
- Lockable
- Explicitly lock a
std::io::Writeable - RawStream
- Required functionality for underlying
std::io::Writefor adaptation
Functions§
- force_
color auto - Override the detected
ColorChoice - stderr
auto - Create an ANSI escape code compatible stderr
- stdout
auto - Create an ANSI escape code compatible stdout