Removes derive-getters, as it was incredibly annoying in IDEs, and couldn't figure out borrow lifetimes.

This commit is contained in:
2022-06-06 14:43:41 +02:00
parent ce33ec0649
commit c27ea0ae1e
16 changed files with 395 additions and 57 deletions

View File

@@ -1,10 +1,9 @@
use self::super::form::Form;
use crate::static_data::species_data::gender::Gender;
use crate::utils::random::Random;
use derive_getters::Getters;
use hashbrown::{HashMap, HashSet};
#[derive(Debug, Getters)]
#[derive(Debug)]
pub struct Species<'a> {
id: u16,
name: String,
@@ -37,6 +36,27 @@ impl<'a> Species<'a> {
flags,
}
}
pub fn id(&self) -> u16 {
self.id
}
pub fn name(&self) -> &str {
&self.name
}
pub fn gender_rate(&self) -> f32 {
self.gender_rate
}
pub fn growth_rate(&self) -> &str {
&self.growth_rate
}
pub fn capture_rate(&self) -> u8 {
self.capture_rate
}
pub fn forms(&self) -> &HashMap<String, Form<'a>> {
&self.forms
}
pub fn flags(&self) -> &HashSet<String> {
&self.flags
}
pub fn add_form(&mut self, id: String, form: Form<'a>) {
self.forms.insert(id, form);