serde-csv-core

Crates.io Released API docs Continuous integration

CSV serialization and deserialization for no_std crates.

serde-csv-core builds upon csv-core crate.

Serialization

to_slice serializes one record at a time. ```rust use heapless::String;

[derive(serde::Serialize)]

struct Record { pub country: String<32>, pub city: String<32>, pub population: u32 }

let records = [ Record { country: "Poland".into(), city: "Cracow".into(), population: 766683, }, Record { country: "Japan".into(), city: "Tokyo".into(), population: 13515_271, }, ];

let mut writer = csv_core::Writer::new(); let mut buf = [0; 128]; let mut len = 0;

for record in records { len += serdecsvcore::to_slice(&mut writer, &record, &mut buf[len..]).unwrap(); }

assert_eq!(&buf[..len], b"Poland,Cracow,766683\nJapan,Tokyo,13515271\n"); ```

Deserialization

Not yet implemented.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.