Macro std::print 1.0.0[−][src]
macro_rules! print {
($($arg : tt) *) => { ... };
}
Expand description
打印到标准输出。
等效于 println!
宏,只是在消息末尾不打印换行符。
注意,默认情况下,stdout 通常是行缓冲的,因此可能有必要使用 io::stdout().flush()
以确保立即发出输出。
print!
仅用于程序的主要输出。请改用 eprint!
打印错误和进度消息。
Panics
如果写入 io::stdout()
失败,就会出现 panics。
Examples
use std::io::{self, Write};
print!("this ");
print!("will ");
print!("be ");
print!("on ");
print!("the ");
print!("same ");
print!("line ");
io::stdout().flush().unwrap();
print!("this string has a newline, why not choose println! instead?\n");
io::stdout().flush().unwrap();
Run