X-Git-Url: http://git.scottworley.com/tablify/blobdiff_plain/a05772014cb65edac0cc664296802036bdc48ca4..bc55297895c1343baa24c93330438972a0c4ac89:/src/lib.rs?ds=inline diff --git a/src/lib.rs b/src/lib.rs index e8a2ea0..6d147dd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,6 +31,14 @@ impl Config { Ok(()) } } +impl Default for Config { + fn default() -> Self { + Self { + column_threshold: 2, + static_columns: vec![], + } + } +} const HEADER: &str = r#" @@ -208,10 +216,7 @@ impl<'cfg, Input: Iterator>> Iterator } fn read_input(input: impl std::io::Read) -> Result<(Vec, Config), std::io::Error> { - let mut config = Config { - column_threshold: 2, - static_columns: vec![], - }; + let mut config = Config::default(); let reader = Reader::new(&mut config, std::io::BufReader::new(input).lines()); reader .collect::, _>>() @@ -722,10 +727,7 @@ mod tests { fn test_render_row() { assert_eq!( render_row( - &Config { - column_threshold: 0, - static_columns: vec![], - }, + &Config::default(), &["foo".to_owned()], &mut Rowlike::Row(Row { label: "nope".to_owned(),