Expand description
Auto-adapting stdout / stderr streams
A portmanteau of “ansi stream”
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.
Available styling crates:
- anstyle for minimal runtime styling, designed to go in public APIs (once it hits 1.0)
- owo-colors for feature-rich runtime styling
- color-print for feature-rich compile-time styling
Example
use anstream::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
- Gracefully degrade styled output
Macros
- Prints tostderr.
- Prints tostderr, with a newline.
- Panics the current thread.
- Prints tostdout.
- Prints tostdout, with a newline.
Structs
- std::io::Writethat adapts ANSI escape codes to the underlying- Writes capabilities
- In-memoryRawStream
- Only pass printable data to the innerWrite
Enums
- Selection for overriding color output Selection for overriding color output
Traits
- Explicitly lock astd::io::Writeable
- Required functionality for underlyingstd::io::Writefor adaptation
Functions
- Create an ANSI escape code compatible stderr
- Create an ANSI escape code compatible stdout