Attempt to add FlexBuffers format

This commit is contained in:
Zykino 2022-10-29 20:33:38 +02:00
parent f5b2a25eaf
commit 91d5fc666f
3 changed files with 31 additions and 6 deletions

View File

@ -28,6 +28,7 @@ serde-transcode = "1.1"
#ciborium = "0.2"
#envy = "0.4" # No `Deserializer` exposed.
#envy-store = "0.1" # No `Deserializer` exposed.
#flexbuffers = "2.0" # `Serializer` and `Deserializer` exposed does not provieded required API.
serde_json = "1.0"
json5 = "0.4"
#serde-lexpr = "0.1"

View File

@ -27,21 +27,24 @@ tradaf RON json < examples/gameConfig.ron | jq .key_bindings | tradaf Json yaml
* [ ] Implement all [data formats](https://serde.rs/#data-formats), or at least the one that expose a serde serializer or deserializer.
* [ ] BSON
* [ ] CBOR
* [ ] DBus (not sure it is working, but it compile…)
* [-] DBus (not sure it is working, but it compile…)
* [ ] Envy (deserialization only)
* [ ] Envy store (deserialization only)
* [ ] GVariant => See DBus: the same crate propose both
* [ ] FlexBuffer
* The `Serializer` and `Deserializer` exposed does not work with serde-transcode.
* [-] GVariant => See DBus: the same crate propose both
* [X] JSON
* [ ] JSON5
* [-] JSON5
* [X] Deserialization
* [ ] Serialization
* [X] S-Expressions (lisp)
* [ ] https://github.com/Lucretiel/kaydle
* [ ] S-Expressions (lisp)
* [X] Pickle
* [ ] Test properly both way
* [ ] Query String (URL)
* [-] Query String (URL)
* [ ] Deserialization
* [X] Serialization
* [ ] MessagePack
* [-] MessagePack
* [ ] Deserialization
* [X] Serialization
* [X] RON

View File

@ -34,6 +34,7 @@ pub enum Input {
//Bson,
//Cbor,
DBus,
//FlexBuffer,
GVariant,
Json,
Json5,
@ -51,6 +52,7 @@ pub enum Output {
//Bson,
//Cbor,
DBus,
//FlexBuffer,
GVariant,
Json,
//Json5, // NOTE: The crate is not noted "(deserialization only)" on the [serde listing](https://serde.rs/#data-formats) but it does not expose a `Serializer`
@ -108,6 +110,14 @@ fn de(opt: &Opt, input: &mut dyn Read, output: &mut dyn Write) {
);
ser(opt, &mut deserializer, output);
}
/*
Input::FlexBuffer => {
use serde_yaml::Deserializer;
let deserializer = Deserializer::from_reader(input);
ser(opt, deserializer, output);
}
*/
Input::GVariant => {
use zvariant::gvariant::Deserializer;
use zvariant::EncodingContext;
@ -219,6 +229,17 @@ where
// let mut deserializer = Deserializer::new();
serde_transcode::transcode(deserializer, serializer).unwrap();
}
/*
Output::FlexBuffer => {
use flexbuffers::FlexbufferSerializer as Serializer;
let serializer = &mut Serializer::new(/*output*/);
// serde_transcode::transcode(deserializer, serializer).unwrap();
let r = flexbuffers::Reader::get_root(serializer.view()).unwrap();
println!("{}", r);
}
*/
Output::GVariant => {
use zvariant::gvariant::Serializer;
use zvariant::EncodingContext;