Struct pokemon_go_data::Level
[−]
[src]
pub struct Level { /* fields omitted */ }
Represents a Pokemon's level.
Methods
impl Level
[src]
fn new<T: Into<f64> + Copy>(level: T) -> Option<Level>
[src]
Create a new Level
from the given parameter. Returns None
if the given value is not a valid
level.
A value is a valid Level
if:
- 1 <=
value
<= 39 - The fractional part of
value
is0
or0.5
Example:
use pokemon_go_data::Level; let level = Level::new(20.5).unwrap(); assert_eq!(level.value(), 20.5); assert!(Level::new(20.4).is_none());
fn value(&self) -> f64
[src]
The internal wrapped value.
fn cp_multiplier(&self) -> f64
[src]
Returns the combat power multiplier corresponding to this level. This value is used to calculate a Pokemon's combat power from its base stats.
fn min() -> Level
[src]
Returns the lowest possible Pokemon level.
use pokemon_go_data::Level; assert_eq!(Level::min().value(), 1.0);
fn max() -> Level
[src]
Returns the highest possible Pokemon level.
use pokemon_go_data::Level; assert_eq!(Level::max().value(), 39.0);
Trait Implementations
impl Debug for Level
[src]
impl PartialEq for Level
[src]
fn eq(&self, other: &Level) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.