pub trait Controller<C, O> {
    // Required methods
    fn measure<'a, I>(&self, cells: I) -> Result<O, CalcError>
       where C: 'a + Serialize + for<'b> Deserialize<'b>,
             I: IntoIterator<Item = &'a CellAgentBox<C>> + Clone;
    fn adjust<'a, 'b, I, J>(
        &mut self,
        measurements: I,
        cells: J
    ) -> Result<(), ControllerError>
       where O: 'a,
             C: 'b + Serialize + for<'c> Deserialize<'c>,
             I: Iterator<Item = &'a O>,
             J: Iterator<Item = (&'b mut CellAgentBox<C>, &'b mut Vec<CycleEvent>)>;
}
Expand description

An external controller which can see all of the simulation domain’s cells and perform modifications on individual cells. This controller is only useful when describing systems that are controlled from the outside and not subject to local interactions. This trait is not finalized yet.

Required Methods§

source

fn measure<'a, I>(&self, cells: I) -> Result<O, CalcError>
where C: 'a + Serialize + for<'b> Deserialize<'b>, I: IntoIterator<Item = &'a CellAgentBox<C>> + Clone,

This function views a part of the simulation domain and retrieves information about the cells contained in it. Afterwards, this measurement is stored and then a collection of measurements is provided to the adjust function.

source

fn adjust<'a, 'b, I, J>( &mut self, measurements: I, cells: J ) -> Result<(), ControllerError>
where O: 'a, C: 'b + Serialize + for<'c> Deserialize<'c>, I: Iterator<Item = &'a O>, J: Iterator<Item = (&'b mut CellAgentBox<C>, &'b mut Vec<CycleEvent>)>,

Function that operates on cells given an iterator over measurements. It modifies cellular properties and can invoke CycleEvenets.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<C> Controller<C, ()> for ()

source§

fn measure<'a, I>(&self, _cells: I) -> Result<(), CalcError>
where C: 'a + Serialize + for<'b> Deserialize<'b>, I: IntoIterator<Item = &'a CellAgentBox<C>> + Clone,

source§

fn adjust<'a, 'b, I, J>( &mut self, measurements: I, cells: J ) -> Result<(), ControllerError>
where (): 'a, C: 'b + Serialize + for<'c> Deserialize<'c>, I: Iterator<Item = &'a ()>, J: Iterator<Item = (&'b mut CellAgentBox<C>, &'b mut Vec<CycleEvent>)>,

Implementors§