Add support for RON as an input/output format
This commit is contained in:
parent
62fcdd7e8c
commit
cd03e06ade
22
Cargo.lock
generated
22
Cargo.lock
generated
@ -97,6 +97,12 @@ version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.21.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
@ -108,6 +114,9 @@ name = "bitflags"
|
||||
version = "2.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
@ -333,6 +342,7 @@ dependencies = [
|
||||
"color-print",
|
||||
"dust-lang",
|
||||
"postcard",
|
||||
"ron",
|
||||
"serde_json",
|
||||
"serde_yaml",
|
||||
"tracing",
|
||||
@ -726,6 +736,18 @@ version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
||||
|
||||
[[package]]
|
||||
name = "ron"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bitflags 2.8.0",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.1"
|
||||
|
@ -23,6 +23,7 @@ clap = { version = "4.5.14", features = [
|
||||
color-print = "0.3.7"
|
||||
dust-lang = { path = "../dust-lang" }
|
||||
postcard = "1.0.10"
|
||||
ron = "0.8.1"
|
||||
serde_json = "1.0.133"
|
||||
serde_yaml = "0.9.34"
|
||||
tracing = "0.1.41"
|
||||
|
@ -191,6 +191,7 @@ enum Command {
|
||||
enum OutputFormat {
|
||||
Cli,
|
||||
Json,
|
||||
Ron,
|
||||
Yaml,
|
||||
}
|
||||
|
||||
@ -198,6 +199,7 @@ enum OutputFormat {
|
||||
enum InputFormat {
|
||||
Dust,
|
||||
Json,
|
||||
Ron,
|
||||
Yaml,
|
||||
}
|
||||
|
||||
@ -279,6 +281,9 @@ fn main() {
|
||||
InputFormat::Json => {
|
||||
serde_json::from_str(&source).expect("Failed to deserialize JSON into chunk")
|
||||
}
|
||||
InputFormat::Ron => {
|
||||
ron::de::from_str(&source).expect("Failed to deserialize RON into chunk")
|
||||
}
|
||||
InputFormat::Yaml => {
|
||||
serde_yaml::from_str(&source).expect("Failed to deserialize YAML into chunk")
|
||||
}
|
||||
@ -354,6 +359,12 @@ fn main() {
|
||||
|
||||
println!("{json}");
|
||||
}
|
||||
OutputFormat::Ron => {
|
||||
let ron = ron::ser::to_string_pretty(&chunk, Default::default())
|
||||
.expect("Failed to serialize chunk to RON");
|
||||
|
||||
println!("{ron}");
|
||||
}
|
||||
OutputFormat::Yaml => {
|
||||
let yaml =
|
||||
serde_yaml::to_string(&chunk).expect("Failed to serialize chunk to YAML");
|
||||
|
Loading…
x
Reference in New Issue
Block a user