Try to add S-Expressions (LISP family)
This commit is contained in:
		| @@ -26,11 +26,15 @@ serde-transcode = "1.1.1" | |||||||
| # Should tend to be equal to the official list of data formats supported by serde: https://serde.rs/#data-formats | # Should tend to be equal to the official list of data formats supported by serde: https://serde.rs/#data-formats | ||||||
| #bson = "2.3" | #bson = "2.3" | ||||||
| #ciborium = "0.2" | #ciborium = "0.2" | ||||||
|  | #envy = "0.4" # No `Deserializer` exposed. | ||||||
|  | #envy-store = "0.1" # No `Deserializer` exposed. | ||||||
| serde_json = "1.0" | serde_json = "1.0" | ||||||
| json5 = "0.4" | json5 = "0.4" | ||||||
|  | #serde-lexpr = "0.1" | ||||||
| serde-pickle = "1.0" | serde-pickle = "1.0" | ||||||
| serde_qs = "0.10" | serde_qs = "0.10" | ||||||
| rmp-serde = "1.1" | rmp-serde = "1.1" | ||||||
| ron = "0.8" | ron = "0.8" | ||||||
| #toml = "0.5" | #toml = "0.5" | ||||||
| serde_yaml = "0.9" | serde_yaml = "0.9" | ||||||
|  |   | ||||||
							
								
								
									
										24
									
								
								src/lib.rs
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								src/lib.rs
									
									
									
									
									
								
							| @@ -27,6 +27,7 @@ pub enum Input { | |||||||
|     //Cbor, |     //Cbor, | ||||||
|     Json, |     Json, | ||||||
|     Json5, |     Json5, | ||||||
|  |     //SExpression, | ||||||
|     Pickle, |     Pickle, | ||||||
|     //Qs,   // NOTE: The crate is not noted "(serialization only)" on the [serde listing](https://serde.rs/#data-formats) but it does not expose a `Deserializer` |     //Qs,   // NOTE: The crate is not noted "(serialization only)" on the [serde listing](https://serde.rs/#data-formats) but it does not expose a `Deserializer` | ||||||
|     //Rmp,  // NOTE: It appears that we are forced to deserialize into a concrete type |     //Rmp,  // NOTE: It appears that we are forced to deserialize into a concrete type | ||||||
| @@ -41,6 +42,7 @@ pub enum Output { | |||||||
|     //Cbor, |     //Cbor, | ||||||
|     Json, |     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` |     //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` | ||||||
|  |     //SExpression, | ||||||
|     Pickle, |     Pickle, | ||||||
|     Qs, |     Qs, | ||||||
|     Rmp, |     Rmp, | ||||||
| @@ -72,8 +74,8 @@ fn de(opt: &Opt, input: &mut dyn Read, output: &mut dyn Write) { | |||||||
|         Input::Bson => { |         Input::Bson => { | ||||||
|             use bson::Deserializer; |             use bson::Deserializer; | ||||||
|  |  | ||||||
|             let mut deserializer = bson::from_reader(input).unwrap(); // FIXME: need which type annotation? |             let deserializer = bson::from_reader(input).unwrap();    // FIXME: can we skip the type annotation? | ||||||
|             ser(opt, &mut deserializer, output); |             ser(opt, deserializer, output); | ||||||
|         } |         } | ||||||
|         */ |         */ | ||||||
|         Input::Json => { |         Input::Json => { | ||||||
| @@ -93,6 +95,14 @@ fn de(opt: &Opt, input: &mut dyn Read, output: &mut dyn Write) { | |||||||
|             let mut deserializer = Deserializer::from_str(&buf).unwrap(); |             let mut deserializer = Deserializer::from_str(&buf).unwrap(); | ||||||
|             ser(opt, &mut deserializer, output); |             ser(opt, &mut deserializer, output); | ||||||
|         } |         } | ||||||
|  |         /* | ||||||
|  |         Input::SExpression => { | ||||||
|  |             use serde_lexpr as Deserializer; | ||||||
|  |  | ||||||
|  |             let deserializer = Deserializer::from_reader(input).unwrap();    // FIXME: can we skip the type annotation? | ||||||
|  |             ser(opt, deserializer, output); | ||||||
|  |         } | ||||||
|  |         */ | ||||||
|         Input::Pickle => { |         Input::Pickle => { | ||||||
|             use serde_pickle::Deserializer; |             use serde_pickle::Deserializer; | ||||||
|  |  | ||||||
| @@ -135,7 +145,7 @@ where | |||||||
|                 options.human_readable(false) |                 options.human_readable(false) | ||||||
|             }; |             }; | ||||||
|  |  | ||||||
|             let serializer = Serializer::new_with_options(options.build()); // FIXME: why no way to tell the serializer were we want the output? |             let serializer = Serializer::new_with_options(options.build());    // FIXME: why no way to tell the serializer were we want the output? | ||||||
|             serde_transcode::transcode(deserializer, serializer).unwrap(); |             serde_transcode::transcode(deserializer, serializer).unwrap(); | ||||||
|         } |         } | ||||||
|         */ |         */ | ||||||
| @@ -156,6 +166,14 @@ where | |||||||
|             // NOTE: serde_json’s PrettyFormatter and CompactFormatter are incompatibles… |             // NOTE: serde_json’s PrettyFormatter and CompactFormatter are incompatibles… | ||||||
|             // serde_transcode::transcode(deserializer, serializer).unwrap(); |             // serde_transcode::transcode(deserializer, serializer).unwrap(); | ||||||
|         } |         } | ||||||
|  |         /* | ||||||
|  |         Output::SExpression => { | ||||||
|  |             use serde_lexpr::to_writer as Serializer; | ||||||
|  |  | ||||||
|  |             let serializer = Serializer::new(output);    // FIXME: There is a `to_writer` but the Serializer is not exposed directly. | ||||||
|  |             serde_transcode::transcode(deserializer, serializer).unwrap(); | ||||||
|  |         } | ||||||
|  |         */ | ||||||
|         Output::Pickle => { |         Output::Pickle => { | ||||||
|             use serde_pickle::Serializer; |             use serde_pickle::Serializer; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user