Macro print
#[macro_export]
macro_rules! print {
($($arg:tt)*) => { ... };
}
Prints to [stdout][crate::stdout].
Equivalent to the [println!] macro except that a newline is not printed at
the end of the message.
Note that stdout is frequently line-buffered by default so it may be
necessary to use [std::io::Write::flush()] to ensure the output is emitted
immediately.
NOTE: The print! macro will lock the standard output on each call. If you call
print! within a hot loop, this behavior may be the bottleneck of the loop.
To avoid this, lock stdout with [AutoStream::lock][crate::AutoStream::lock]:
#
Use print! only for the primary output of your program. Use
[eprint!] instead to print error and progress messages.
NOTE: Not all print! calls will be captured in tests like [std::print!]
- Capturing will automatically be activated in test binaries
- Otherwise, only when the
testfeature is enabled
Panics
Panics if writing to stdout fails for any reason except broken pipe.
Writing to non-blocking stdout can cause an error, which will lead this macro to panic.
Examples
#