Skip to content

set multiple headers at once

this feels a bit repetitive:

table.column(0).set_header("TIME");
table.column(1).set_header("TICKET");
table.column(2).set_header("SUBJECT");
table.column(3).set_header("MODE");
table.column(4).set_header("TYPE");
table.column(5).set_header("TEACHER");
table.column(6).set_header("ISSUE");

would be amazing if the same could be done like so:

let headers = ["TIME", "TICKET", "SUBJECT", "MODE", "TYPE", "TEACHER", "ISSUE"];
table.set_headers(&headers);
// or maybe even better:
let table = AsciiTable::default().with_headers(headers);
// I guess the arg could be something like this: `headers: Iter<Item = impl ToString>`
// this is just a rough idea though

in case of skipping columns:

let table = AsciiTable::default().with_headers(["Time", "Place", /* no header: */ "", "Sins", "Objects"])