pub fn tabulate<Data, Row>(
tabular_data: Data,
options: TabulateOptions,
) -> Result<String, TabulateError>where
Data: IntoIterator<Item = Row>,
Row: Serialize,Expand description
Render tabular_data according to the provided options.
Examples found in repository?
examples/basic.rs (lines 12-17)
3fn main() {
4 let planets = vec![
5 vec!["Planet", "Radius (km)", "Mass (10^24 kg)"],
6 vec!["Mercury", "2440", "0.330"],
7 vec!["Venus", "6052", "4.87"],
8 vec!["Earth", "6371", "5.97"],
9 vec!["Mars", "3390", "0.642"],
10 ];
11
12 let table = tabulate(
13 planets,
14 TabulateOptions::new()
15 .headers(Headers::FirstRow)
16 .table_format("grid"),
17 )
18 .expect("tabulation succeeds");
19
20 println!("{table}");
21}