Created
July 10, 2019 15:18
-
-
Save rust-play/2c6260b63905b0953434c96f7ad4055e to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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