Skip to main content

Agent

Trait Agent 

Source
pub trait Agent {
    // Required method
    fn id(&self) -> AgentId;
}
Expand description

The core trait that every agent type must implement.

An agent is any entity that participates in the simulation. The only requirement is a unique identifier accessible via Agent::id.

§Example

use rustsim_core::prelude::*;

#[derive(Debug, Clone)]
struct Particle {
    id: AgentId,
    x: f64,
}

impl Agent for Particle {
    fn id(&self) -> AgentId { self.id }
}

Required Methods§

Source

fn id(&self) -> AgentId

Returns the unique identifier for this agent.

Implementors§