Crates.io | pokemon-utils |
lib.rs | pokemon-utils |
version | 0.1.32 |
source | src |
created_at | 2023-10-02 00:06:38.40207 |
updated_at | 2024-10-03 17:39:53.63681 |
description | a collection of pokemon related utilities Project homepage: https://github.com/isaacadams/pokemon-utils |
homepage | https://github.com/isaacadams/pokemon-utils |
repository | https://github.com/isaacadams/pokemon-utils |
max_upload_size | |
id | 989511 |
size | 151,771 |
a collection of pokemon related utilities
use pokemon_utils::{self, is_rare, PokedexEntry};
fn main() {
let pokemon = pokemon_utils::encounter_random_pokemon();
// one way to convert pokemon index into an entry
let _: &PokedexEntry = PokedexEntry::get_by_id(pokemon as usize).unwrap();
// another way to do the conversion
let entry: &PokedexEntry = pokemon.try_into().unwrap();
println!("found a wild {}!", entry.name);
println!("is rare? {}", is_rare(&entry.index));
}