Open Saethox opened 1 year ago
A shortcut for exposing Component
parameters would also be handy. Maybe something like this is possible with some proc-macro magic:
Annotate component fields with some attribute, which generates a SomeComponentMutationRate(f64)
custom state struct:
#[derive(ExposedParameter)]
pub struct SomeComponent {
#[expose(rename = "mutation_rate")]
pub f64: rm,
}
The struct can then be referred to in Component
methods using some Param![]
macro:
fn execute(problem: &P, state: &mut State<P>) -> ExecResult<()> {
let mutation_rate = state.get_value::<Param![SomeComponent::mutation_rate]>();
...
}
Maybe it's even possible to use Param![Self::mutation_rate]
in SomeComponent
.
should implement
CustomState
andbetter_any::Tid
(or an equivalent). It should also handle a single lifetime and multiple generics correctly.