Expand description
Perl-like diamond operator for Rust
// Prints all lines from files and standard input specified by command line
// arguments or from standard input if no argument is given.
fn main() {
for line in diamond_op::new().line_iter() {
print!("{}", line.expect("failed to read line"));
}
}# Prints all lines from file1.txt, file2.txt, standard input, and file3.txt.
mycmd file1.txt file2.txt - file3.txtStructs§
- Diamond
- A structure that reads lines, like Perl’s diamond (
<>) operator and many Unix filter programs, from files and standard input (“-”) specified by command line arguments or from standard input if no argument is given.
Functions§
- new
- Returns a diamond operator instance.