Trait SubValueProvider

Source
pub trait SubValueProvider {
    // Required methods
    fn identifier(&self) -> SubValueProviderId;
    fn get_random_subvalue(
        &self,
        typeid: TypeId,
        max_cplx: f64,
    ) -> Option<(&dyn Any, f64)>;
    fn get_subvalue(
        &self,
        typeid: TypeId,
        max_cplx: f64,
        index: &mut usize,
    ) -> Option<(&dyn Any, f64)>;
}
Expand description

An object-safe trait which can give values of arbitrary types.

See the documentation of the Mutator trait for more information about its purpose.

Required Methods§

Source

fn identifier(&self) -> SubValueProviderId

A globally unique identifier for the subvalue provider

Source

fn get_random_subvalue( &self, typeid: TypeId, max_cplx: f64, ) -> Option<(&dyn Any, f64)>

Get a subvalue of the given type and under a certain maximum complexity.

Returns Some((subvalue, cplx)) or None if no subvalue matches the type id or maximum complexity.

Source

fn get_subvalue( &self, typeid: TypeId, max_cplx: f64, index: &mut usize, ) -> Option<(&dyn Any, f64)>

Get a subvalue of the given type and under a certain maximum complexity.

Each index points to a different subvalue. The function will automatically increment index to the next valid value.

Returns Some((subvalue, cplx)) or None if no more unique subvalues match thhe type id or maximum complexity.

Implementors§