pub trait Agent {
// Required method
fn update<R: RngCore>(&mut self, env: &mut Env, rng: &mut R);
}
Expand description
Homogeneous agent set functionality
A set of agents that implement this trait can then be included in a struct using the Agents macro to combine multiple agent types.
§Examples
use bourse_de::Env;
use bourse_de::agents::{Agent, Agents, AgentSet};
use rand::RngCore;
struct AgentType{}
impl Agent for AgentType {
fn update<R: RngCore>(
&mut self, env: &mut Env, _rng: &mut R
) {}
}
#[derive(Agents)]
struct MixedAgents {
a: AgentType, b: AgentType
}
Required Methods§
Object Safety§
This trait is not object safe.