pub trait GroupTrait<T, const N: usize, const R: usize> {
type Err: Debug;
// Required methods
fn new(data: [T; N]) -> Self;
fn one_cycle(&mut self) -> Result<(), Self::Err>;
fn iter<'a>(&'a self) -> impl Iterator<Item = &'a Individual<T>>
where T: 'a;
// Provided methods
fn init<I>() -> Self
where I: InitializerTrait<T, N>,
Self: Sized { ... }
fn reset_id(&self) { ... }
fn one_cycle_out<W>(&mut self, out: &mut W) -> Result<(), Self::Err>
where W: Write { ... }
fn clone_values(&self) -> Vec<T>
where T: Clone { ... }
}
Expand description
A trait for a group which contains individuals.
T
- A element of this groupN
- The number of individualsR
- The number of individuals after individuals are reduced by selector
Required Associated Types§
Required Methods§
Sourcefn iter<'a>(&'a self) -> impl Iterator<Item = &'a Individual<T>>where
T: 'a,
fn iter<'a>(&'a self) -> impl Iterator<Item = &'a Individual<T>>where
T: 'a,
Create an iterator of indivuduals.
'a
- A lifetime ofself
.
Provided Methods§
Sourcefn init<I>() -> Selfwhere
I: InitializerTrait<T, N>,
Self: Sized,
fn init<I>() -> Selfwhere
I: InitializerTrait<T, N>,
Self: Sized,
Initialize Self
by I
algorithm.
I
- Algorithm of initializing.
Sourcefn one_cycle_out<W>(&mut self, out: &mut W) -> Result<(), Self::Err>where
W: Write,
fn one_cycle_out<W>(&mut self, out: &mut W) -> Result<(), Self::Err>where
W: Write,
Run one cycle with outputing and update individuals.
By default, there is not outputing.(Run one_cycle
simply.)
out
- A target of outputing.
Sourcefn clone_values(&self) -> Vec<T>where
T: Clone,
fn clone_values(&self) -> Vec<T>where
T: Clone,
Clone individuals which are contained by this.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.