Expand description
This crate lets you write an iterator into a LinesWriter, with each item on a line.
The trait is implemented for all the types that implement std::io::Write
.
Simply call write_lines on the writer and pass an iterator as argument.
§Examples
use lines_writer::LinesWriter;
fn main() {
let str = "This is\na string\nto show\nhow do\nthis work";
std::io::stdout().write_lines(str.lines()).unwrap();
}
use lines_writer::LinesWriter;
fn main() {
let array = [10, 15, 63, 29];
std::io::stdout().write_lines(&array).unwrap();
}
Traits§
- Lines
Writer - This trait lets you write an iterator into its implementor with each item on a line.