pub trait AgentSet {
// Required methods
fn call<D: DB, V: Validator, R: RngCore>(
&mut self,
rng: &mut R,
env: &mut Env<D, V>,
) -> Vec<Transaction>;
fn record<D: DB, V: Validator>(&mut self, env: &mut Env<D, V>);
fn get_addresses(&self) -> Vec<Address>;
}Expand description
A homogenous collection of agents
Designed to represent a group of agents of a uniform type and update and record the group state at each step of the simulation.
Required Methods§
Sourcefn call<D: DB, V: Validator, R: RngCore>(
&mut self,
rng: &mut R,
env: &mut Env<D, V>,
) -> Vec<Transaction>
fn call<D: DB, V: Validator, R: RngCore>( &mut self, rng: &mut R, env: &mut Env<D, V>, ) -> Vec<Transaction>
Update all the agents in the set, collecting any EVM calls generated by the agents
§Arguments
rng- Random generateenv- Simulation environment
Sourcefn record<D: DB, V: Validator>(&mut self, env: &mut Env<D, V>)
fn record<D: DB, V: Validator>(&mut self, env: &mut Env<D, V>)
Record the state of all the agents
Sourcefn get_addresses(&self) -> Vec<Address>
fn get_addresses(&self) -> Vec<Address>
Get a vector of agent addresses contained in this set
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.
Implementors§
impl<R: 'static, A: Agent + RecordedAgent<R> + 'static> AgentSet for AgentVec<R, A>
Implementations of agent updates and recording.
impl<R: 'static, A: Agent + RecordedAgent<R> + 'static> AgentSet for SingletonAgent<R, A>
Implementations of agent updates and recording.