I was porting my Pokedex from Java to Rust:
let charizard = Species {
id: "charmeleon",
forms: vec![Form {
id: "charmeleon",
types: Dual(Fire, Flying),
gender_ratio: Male(0.875),
base_stats: Stats { hp: 58, atk: 64, def: 58, spa: 80, spd: 65, spe: 80 },
color: Red,
abilities: Abilities {
primary: "blaze",
secondary: None,
hidden: Some("solar-power"),
},
height: Metres(1.1),
weight: Kilograms(19.0),
egg_groups: vec![Dragon, Monster],
body_style: TailedBiped,
exp_yield: 142,
hatch_time: 4,
catch_rate: 45,
friendship: 70,
stat_yield: Stats { hp: 0, atk: 0, def: 0, spa: 1, spd: 0, spe: 1 },
leveling_rate: LevelRate,
learnset: Learnset,
}],
evolutions: vec!["charizard"],
precursors: Some("charmander"),
};
This code relies a bit heavily on string IDs. Does Rust offer any nicer alternatives to this? I'd rather not use a 721 element enum either, for obvious reasons .