pub struct GenePool {
pub pools: Vec<(String, Vec<String>)>,
}Expand description
Gene pool: the possible values for each gene type.
Fields§
§pools: Vec<(String, Vec<String>)>Available gene types and their possible values.
Implementations§
Source§impl GenePool
impl GenePool
Sourcepub fn default_wafrift() -> Self
pub fn default_wafrift() -> Self
Create a gene pool with WAF Rift’s built-in technique space.
Sourcepub fn values_for(&self, gene_name: &str) -> Option<&[String]>
pub fn values_for(&self, gene_name: &str) -> Option<&[String]>
Get the possible values for a gene type.
Sourcepub fn gene_names(&self) -> Vec<&str>
pub fn gene_names(&self) -> Vec<&str>
Get all gene type names.
Sourcepub fn random_value(
&self,
gene_name: &str,
rng: &mut impl Rng,
) -> Option<String>
pub fn random_value( &self, gene_name: &str, rng: &mut impl Rng, ) -> Option<String>
Pick a random value for a gene type using the provided RNG.
Sourcepub fn all_values(&self) -> Vec<String>
pub fn all_values(&self) -> Vec<String>
Return all unique values across all gene pools.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for GenePool
impl<'de> Deserialize<'de> for GenePool
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for GenePool
impl RefUnwindSafe for GenePool
impl Send for GenePool
impl Sync for GenePool
impl Unpin for GenePool
impl UnsafeUnpin for GenePool
impl UnwindSafe for GenePool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more