SerdeIO
Tiny IO utility library for Rust to serialize/deserialize Serde compatible structs
Install
SerdeIO supports JSON and JSON Lines formats. Additional formats are supported by enabling corresponding features.
yamlcsv
How to use
read_record_from_readeris used to read a deserializable typeTfromstd::io::Read. Data format must be specified byDataFormatenum.read_records_from_readeralways tries to deserialize the data asVec<T>.read_record_from_fileaccepts anAsRef<Path>. Data format is automatically determined by file extension.write_*functions follow the same rules asread_*.
Note that some data format like CSV and JSON Lines support only reading records Vec<T>.
Examples
The following code read a JSON file and parse it as Vec<User>. Then it encodes the data into YAML format and write it to STDOUT.
use ;
use ;
use ;