January 2019
Intermediate to advanced
520 pages
14h 32m
English
Sometimes, you'll be faced with situations in which you need to convert one format to another. In this instance, you can use the serde_transcode crate, which converts one format to another using a standard serde serialization process. The crate has a transcode function that expects a serializer and a deserializer as arguments. You can use it as follows:
let mut deserializer = serde_json::Deserializer::from_reader(reader); let mut serializer = serde_cbor::Serializer::pretty(writer); serde_transcode::transcode(&mut deserializer, &mut serializer).unwrap();
This code converts incoming JSON data into CBOR data. You can read more about this crate at: https://crates.io/crates/serde-transcode.
Read now
Unlock full access