Function std::io::stderr_locked [−][src]
pub fn stderr_locked() -> StderrLock<'static>ⓘNotable traits for StderrLock<'_>impl Write for StderrLock<'_>
Expand description
为当前进程的标准错误创建一个新的锁定句柄。
此句柄未缓冲。
Note: Windows 可移植性注意事项
在控制台中操作时,此流的 Windows 实现不支持非 UTF-8 字节序列。 尝试写入无效的 UTF-8 字节将返回错误。
Example
#![feature(stdio_locked)]
use std::io::{self, Write};
fn main() -> io::Result<()> {
let mut handle = io::stderr_locked();
handle.write_all(b"hello world")?;
Ok(())
}
Run