1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Writes what a grid shows as a file.
//!
//! The table comes from [`datagrid_core::export_table`], which takes the
//! visible columns in the order the grid lays them out and the rows as sorted,
//! filtered and grouped. This crate only writes it: each format is a feature, so
//! that the ones with heavy dependencies cost nothing to anyone who does not
//! ask for them. CSV needs no dependency at all.
//!
//! ```
//! use datagrid_core::{
//! CellValue, ColumnSpec, ExportScope, GridLocale, GridState, export_table,
//! };
//! use datagrid_export::{CsvOptions, to_csv};
//!
//! struct Person {
//! name: &'static str,
//! age: i64,
//! }
//!
//! let rows = [Person { name: "Zoe", age: 31 }, Person { name: "Adi", age: 27 }];
//! let columns = [
//! ColumnSpec::new("name").value(|row: &Person| CellValue::Text(row.name)),
//! ColumnSpec::new("age").value(|row: &Person| CellValue::Int(row.age)),
//! ];
//! let table = export_table(
//! &rows,
//! &columns,
//! |id| id.as_str().to_owned(),
//! &GridState::new(),
//! &GridLocale::english(),
//! ExportScope::Filtered,
//! );
//!
//! assert_eq!(to_csv(&table, &CsvOptions::default()), "name,age\r\nZoe,31\r\nAdi,27\r\n");
//! ```
pub use ;
pub use ;