debian/rust-vendor/bstr/examples/uppercase-std.rs
raw| 1 | use std::error::Error; |
| 2 | use std::io::{self, BufRead, Write}; |
| 3 | |
| 4 | fn main() -> Result<(), Box<dyn Error>> { |
| 5 | let stdin = io::stdin(); |
| 6 | let mut stdin = stdin.lock(); |
| 7 | let mut stdout = io::BufWriter::new(io::stdout()); |
| 8 | |
| 9 | let mut line = String::new(); |
| 10 | while stdin.read_line(&mut line)? > 0 { |
| 11 | stdout.write_all(line.to_uppercase().as_bytes())?; |
| 12 | line.clear(); |
| 13 | } |
| 14 | Ok(()) |
| 15 | } |