Expand description
§pkmn-core-types
Rust library with basic types for use with Pokémon games.
This includes types that represent Pokémon species, items, moves, abilities, natures, and types with values that correspond to the index numbers commonly used in the Pokémon games. These types support serde serialization and deserialization based on the English names for each.
§Goals
- No unsafe code.
no_stdcompatible.- Never panic.
- Limited feature scope.
- Minimal dependencies.
§Cargo features
This library has a default but optional "std" feature for building with the Rust Standard
Library. Build with default features disabled to support no_std environments. alloc is
optional as well.
[depdendencies]
pkmn-core-types = {version = "0.1.0", default-features = false, features = ["alloc"]}§Available types
§Integer-wrapper types
All of these types are simple wrappers around a NonZero integer corresponding to an index
value used by Pokémon games. They implement Display, Serialize,
and Deserialize using English strings instead of the underlying integer value.
For example, a PokemonSpecies containing the value 150 will be serialized as “Mewtwo”,
not “150”.
When the meaning of values differs between generations of Pokémon games, separate types are offered for each relevant generation. The types without a number suffix are generally usable for all other generations that don’t have their own specialization.
These types accept any nonzero value of their underlying primitive type, do not prevent
creation of instances containing values that are invalid for any particular game, and offer
functions that can be used to check whether its value is valid. Because they use
NonZero, these types can be wrapped in an Option without
increasing the size of the memory they occupy.
- Pokémon species:
PokemonSpecies,PokemonSpecies1, andPokemonSpecies3 - Items:
PokemonItem,PokemonItem1,PokemonItem2,PokemonItem3, andPokemonItem4. - Abilities:
AbilityandAbility3. - Moves:
PokemonMove.
§Enums
Several enums are defined in this library which represent a few types that are often used in Pokémon games and have a relatively small number of variants.
- Pokémon Stats:
PokemonStat. - Pokémon Type:
PokemonType,PokemonType1,PokemonType2, andPokemonType3. - Trainer Gender:
TrainerGender. - Nature:
PokemonNature.
Modules§
- gb
- Types that are specific to the Generation 1 and 2 (GB/GBC) Pokémon games.
- gba
- Types that are specific to the Generation 3 (GBA) Pokémon games.
- nds
- Types that are specific to the Generation 4 and 5 (DS) Pokémon games.
Structs§
- Ability
- Identifier for Pokémon abilities in Generation 4 and later.
- Pokemon
Item - Identifier for items that appear in the Pokémon games (Generation 5 and later).
- Pokemon
Move - Identifier for Pokémon moves in all mainline games.
- Pokemon
Species - Identifier representing a Pokémon species by National Dex value.
Enums§
- Pokemon
Nature - Pokémon nature identifier (Generation 3 and later).
- Pokemon
Stat - Stat identifier for Pokémon games (Generation 2 and later).
- Pokemon
Type - Pokémon and move type identifier (catch-all)
- Trainer
Gender - Possible values for trainer gender (Crystal and later).