Writing to a file or stdout in Rust
问题 I'm learning Rust, and I'm somewhat stumped. I'm trying to give the user the option of writing output to stdout or to a supplied filename. I started with the example code that's given for using extra::getopts located here. From there, in the do_work function, I'm trying to do this: use std::io::stdio::stdout; use std::io::buffered::BufferedWriter; fn do_work( input: &str, out: Option<~str> ) { println!( "Input: {}", input ); println!( "Output: {}", match out { Some(x) => x, None => ~"Using