diff --git a/Cargo.toml b/Cargo.toml index ad438b8..606e1fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/README.md b/README.md index b64ec69..551abf9 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/lib.rs b/src/lib.rs index 5d87528..069dc32 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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;