[−][src]Macro bunt::write
write!() { /* proc-macro */ }
Writes formatted data to a termcolor::WriteColor
target.
This is a more general version of print
as you can specify the destination
of the formatted data as first parameter. write
also returns a Result<(), std::io::Error>
which is Err
in case writing to the target or setting the
color fails. print!
simply panics in that case.
use bunt::termcolor::{ColorChoice, StandardStream}; // Printing to stderr, just to show something `print` can't do. let mut stderr = StandardStream::stderr(ColorChoice::Auto); let result = bunt::write!(stderr, "{$red}bad error!{/$}"); if result.is_err() { // Writing to stderr failed... }
See crate-level docs for more information.