Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code shared from the Rust Playground
use serde; // 1.0.94
use serde_derive; // 1.0.94
use toml; // 0.5.1
use serde_derive::Deserialize;
use std::collections::HashMap;
#[derive(Deserialize, Debug, Eq, PartialEq, Hash)]
#[serde(rename_all = "snake_case")]
enum StepType {
Jump,
DoABarrelRoll
}
fn main() {
let toml = r#"do_a_barrel_roll = true"#;
let parsed: HashMap<StepType, String> = toml::from_str(toml).unwrap();
println!("{:?}", parsed);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.