pub fn collect_step<A, M, AgentRow, ModelRow>(
model: &M,
agent_ids: &[AgentId],
agent_report: Option<&dyn Fn(&A, &M) -> AgentRow>,
model_report: Option<&dyn Fn(&M) -> ModelRow>,
agent_data: &mut Vec<AgentRow>,
model_data: &mut Vec<ModelRow>,
)Expand description
Collect one step’s worth of agent and model data.
For each agent ID in agent_ids, if the agent exists and agent_report
is Some, the reporter closure is called and the result appended to
agent_data. If model_report is Some, one model-level row is appended
to model_data.
§Arguments
model- the model to collect from.agent_ids- the agent IDs to report on (typically fromModel::agentiteration).agent_report- optional closure(&Agent, &Model) -> AgentRow.model_report- optional closure(&Model) -> ModelRow.agent_data- accumulator for agent-level rows.model_data- accumulator for model-level rows.