Add URL QueryString serialization

This commit is contained in:
Zykino 2022-09-20 23:23:58 +02:00
parent 2e75ffea68
commit d13a167ac8
3 changed files with 29 additions and 1 deletions

18
Cargo.lock generated
View File

@ -232,6 +232,12 @@ version = "6.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff"
[[package]]
name = "percent-encoding"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]]
name = "pest"
version = "2.3.1"
@ -388,6 +394,17 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_qs"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cac3f1e2ca2fe333923a1ae72caca910b98ed0630bb35ef6f8c8517d6e81afa"
dependencies = [
"percent-encoding",
"serde",
"thiserror",
]
[[package]]
name = "serde_yaml"
version = "0.9.11"
@ -475,6 +492,7 @@ dependencies = [
"serde-pickle",
"serde-transcode",
"serde_json",
"serde_qs",
"serde_yaml",
]

View File

@ -29,6 +29,7 @@ serde-transcode = "1.1.1"
serde_json = "1.0"
json5 = "0.4"
serde-pickle = "1.0"
serde_qs = "0.10"
ron = "0.8"
#toml = "0.5"
serde_yaml = "0.9"

View File

@ -28,6 +28,7 @@ pub enum Input {
Json,
Json5,
Pickle,
//Qs, // NOTE: The crate is not notted "(serialization only)" on the [serde listing](https://serde.rs/#data-formats) but it does not expose a `Deserializer`
Ron,
//Toml
Yaml,
@ -38,8 +39,9 @@ pub enum Output {
//Bson,
//Cbor,
Json,
//Json5, // NOTE: The crate is not notted "(deserialization only)" on the [serde listing](https://serde.rs/#data-formats) but it does not expose a serializer
//Json5, // NOTE: The crate is not notted "(deserialization only)" on the [serde listing](https://serde.rs/#data-formats) but it does not expose a `Serializer`
Pickle,
Qs,
Ron,
//Toml,
Yaml,
@ -159,6 +161,13 @@ where
serde_transcode::transcode(deserializer, serializer).unwrap();
}
Output::Qs => {
use serde_qs::Serializer;
let serializer = &mut Serializer::new(output);
serde_transcode::transcode(deserializer, serializer).unwrap();
}
Output::Ron => {
use ron::Serializer;