Crate anstream
Auto-adapting stdout / stderr streams
A portmanteau of "ansi stream"
AutoStream always accepts ANSI escape codes,
[adapting to the user's terminal's capabilities][AutoStream].
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
- owo-colors for feature-rich runtime styling
- color-print for feature-rich compile-time styling
Example
#
And this will correctly handle piping to a file, etc
Modules
Structs
-
AutoStream
std::io::Writethat adapts ANSI escape codes to the underlyingWrites capabilities -
StripStream
Only pass printable data to the inner
Write