Skip to main content

Crate sheeter_engine

Crate sheeter_engine 

Source
Expand description

Sheeter is a data file conversion library and CLI tool.

This crate provides functions to convert between CSV and JSON formats. It is designed to be small, fast, and portable, suitable for use on low-end devices such as Android phones. The core idea is simple: take data in one format, understand its structure, and emit it in another format without unnecessary overhead.

§Examples

Convert CSV to JSON:

use sheeter_engine::csv_to_json;

let csv = "name,age\nAlice,30\nBob,25";
let json = csv_to_json(csv).unwrap();
assert_eq!(json, r#"[{"name":"Alice","age":"30"},{"name":"Bob","age":"25"}]"#);

Convert JSON to CSV:

use sheeter_engine::json_to_csv;

let json = r#"[{"name":"Alice","age":"30"},{"name":"Bob","age":"25"}]"#;
let csv = json_to_csv(json).unwrap();
assert_eq!(csv, "name,age\nAlice,30\nBob,25\n");

Re-exports§

pub use canonical::CanonicalValue;
pub use filter::Filter;
pub use inspect::inspect;
pub use transform::Transforms;

Modules§

canonical
filter
inspect
transform

Enums§

Format
Supported data formats.
SqlDialect
SQL dialect used when parsing input. The writer emits ANSI-compatible INSERT statements that SQLite, PostgreSQL, and MySQL all accept.

Functions§

convert
Converts input from one format to another via the canonical hub.
convert_workbook
Converts a byte buffer between formats, supporting multi-sheet workbooks.
convert_workbook_with_options
Like convert_workbook, but lets the caller pick the SQL dialect and the table name used when writing SQL output.
csv_to_json
Converts a CSV string into a JSON array of objects.
csv_to_toml
Converts CSV to TOML via the canonical hub.
csv_to_tsv
Converts CSV to TSV by composing csv_to_json and json_to_tsv.
csv_to_xml
Converts CSV to XML via the canonical hub.
csv_to_yaml
Converts CSV to YAML by composing csv_to_json and json_to_yaml.
json_to_csv
Converts a JSON array of objects into a CSV string.
json_to_toml
Converts a JSON value to TOML.
json_to_tsv
Converts a JSON array of objects into a TSV string.
json_to_xml
Converts a JSON value to XML.
json_to_yaml
Converts a JSON array of objects into a YAML sequence of mappings.
stream_delimited
Converts CSV or TSV input to CSV or TSV output using constant memory.
toml_to_csv
Converts a TOML document to CSV, extracting the first array of tables.
toml_to_json
Converts a TOML document to a JSON value.
toml_to_tsv
Converts a TOML document to TSV.
toml_to_xml
Converts a TOML document to XML.
toml_to_yaml
Converts a TOML document to YAML.
tsv_to_csv
Converts TSV to CSV by composing tsv_to_json and json_to_csv.
tsv_to_json
Converts a TSV string into a JSON array of objects.
tsv_to_toml
Converts TSV to TOML via the canonical hub.
tsv_to_xml
Converts TSV to XML via the canonical hub.
tsv_to_yaml
Converts TSV to YAML by composing tsv_to_json and json_to_yaml.
xml_to_csv
Converts XML to CSV, extracting the tabular array if present.
xml_to_json
Converts an XML document to a JSON representation.
xml_to_toml
Converts XML to TOML via the canonical hub.
xml_to_tsv
Converts XML to TSV, extracting the tabular array if present.
xml_to_yaml
Converts XML to YAML, extracting the tabular array if present.
yaml_to_csv
Converts YAML to CSV by composing yaml_to_json and json_to_csv.
yaml_to_json
Converts a YAML sequence of mappings into a JSON array of objects.
yaml_to_toml
Converts YAML to TOML via the canonical hub.
yaml_to_tsv
Converts YAML to TSV by composing yaml_to_json and json_to_tsv.
yaml_to_xml
Converts YAML to XML via the canonical hub.

Type Aliases§

OutputDoc
One output document: (sheet_name, bytes). Returned by convert_workbook because multi-sheet inputs can produce more than one output.