X-Git-Url: http://git.scottworley.com/tablify/blobdiff_plain/76638ea1debd36a19c5702d22cc50b1e79f44570..7067975b593ef6a8b639f61dda710b023ec26a25:/src/lib.rs?ds=inline diff --git a/src/lib.rs b/src/lib.rs index 5de1c12..a3878c5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ use std::collections::{HashMap, HashSet}; +use std::fmt::Write; use std::io::BufRead; use std::iter::Iterator; @@ -190,10 +191,10 @@ fn render_row(columns: &[String], row: &RowInput) -> String { fn render_column_headers(columns: &[String]) -> String { // TODO: Escape HTML special characters String::from("") - + &columns - .iter() - .map(|c| format!("{c}")) - .collect::() + + &columns.iter().fold(String::new(), |mut acc, c| { + write!(&mut acc, "{c}").unwrap(); + acc + }) + "\n" }