comparison src/th06/ecl.rs @ 665:965ecdbf0316

Make rank user-defined in eclrenderer.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 11 Aug 2019 20:14:20 +0200
parents f08e8e3c6196
children 1bb8b34dbd32
comparison
equal deleted inserted replaced
664:f08e8e3c6196 665:965ecdbf0316
23 /// Lunatic mode. 23 /// Lunatic mode.
24 const Lunatic = 0x800; 24 const Lunatic = 0x800;
25 25
26 /// Any or all modes. 26 /// Any or all modes.
27 const All = 0xff00; 27 const All = 0xff00;
28 }
29 }
30
31 impl std::str::FromStr for Rank {
32 type Err = String;
33
34 fn from_str(s: &str) -> Result<Rank, Self::Err> {
35 Ok(match s {
36 "easy" => Rank::Easy,
37 "normal" => Rank::Normal,
38 "hard" => Rank::Hard,
39 "lunatic" => Rank::Lunatic,
40 _ => return Err(format!("unknown rank {}", s))
41 })
28 } 42 }
29 } 43 }
30 44
31 /// A single instruction, part of a `Script`. 45 /// A single instruction, part of a `Script`.
32 #[derive(Debug, Clone)] 46 #[derive(Debug, Clone)]