Function render

Source
pub fn render<W, T, R, C>(writer: &mut W, data: T) -> Result<()>
where W: Write, T: AsRef<[R]>, R: AsRef<[C]>, C: Display,
Expand description

Render the table to a writer

Note that there are a lot of write calls, use a BufferedWriter if your writer is I/O for better performance.

ยงPanics

Will panic if all rows are not the same length

Examples found in repository?
examples/simple.rs (line 11)
6fn main() {
7    // can be vec or slices
8    let data = [["A", "2x2"], ["pretty", "table"]];
9    // we can either render to an array...
10    let mut out = Vec::new();
11    text_tables::render(&mut out, data).unwrap();
12    println!("{}", str::from_utf8(&out).unwrap());
13    // ...or we can use `Write` streams directly
14    text_tables::render(&mut io::stdout(), data).unwrap();
15}