]> git.proxmox.com Git - rustc.git/blob - vendor/bstr/examples/uppercase.rs
New upstream version 1.70.0+dfsg2
[rustc.git] / vendor / bstr / examples / uppercase.rs
1 use std::error::Error;
2 use std::io::{self, Write};
3
4 use bstr::{io::BufReadExt, ByteSlice};
5
6 fn main() -> Result<(), Box<dyn Error>> {
7 let stdin = io::stdin();
8 let mut stdout = io::BufWriter::new(io::stdout());
9
10 let mut upper = vec![];
11 stdin.lock().for_byte_line_with_terminator(|line| {
12 upper.clear();
13 line.to_uppercase_into(&mut upper);
14 stdout.write_all(&upper)?;
15 Ok(true)
16 })?;
17 Ok(())
18 }