Skip to main content

plugin

Function plugin 

Source
pub fn plugin() -> Plugin
Expand description

The plugin form of csv, for Tabnas::use_plugin, with the documented defaults: the counterpart of tn.use(Csv, options) in TypeScript and j.UseDefaults(Csv, Defaults, options) in Go. The option bag use_plugin takes is deep-merged over the defaults and read as a CsvOptions.

use tabnas::Value;

let mut parser = tabnas_jsonic::make();
let options = Value::from_json(&serde_json::json!({ "object": false }));
parser.use_plugin(tabnas_csv::plugin(), Some(options))?;
assert_eq!(parser.parse("a,b\n1,2")?.to_json().to_string(), r#"[["1","2"]]"#);