pub struct AgentRegistry { /* private fields */ }Expand description
Registry that manages all registered agents with automatic priority ordering.
Agents are automatically sorted by priority (highest first) and can be iterated in execution order.
Implementations§
Source§impl AgentRegistry
impl AgentRegistry
Sourcepub fn register(&mut self, agent: Arc<Mutex<dyn Agent>>, priority: f32)
pub fn register(&mut self, agent: Arc<Mutex<dyn Agent>>, priority: f32)
Registers an agent with the given priority.
Higher priority values mean the agent is updated first.
Sourcepub fn iter(&self) -> impl Iterator<Item = &Arc<Mutex<dyn Agent>>>
pub fn iter(&self) -> impl Iterator<Item = &Arc<Mutex<dyn Agent>>>
Returns an iterator over all agents in priority order (highest first).
Sourcepub fn update_all(&self, context: &mut EngineContext<'_>)
pub fn update_all(&self, context: &mut EngineContext<'_>)
Updates all agents in priority order.
Sourcepub fn execute_all(&self)
pub fn execute_all(&self)
Executes all agents in priority order.
Called after update_all each frame. Each agent
performs its primary work (e.g., the RenderAgent renders,
the PhysicsAgent simulates).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AgentRegistry
impl RefUnwindSafe for AgentRegistry
impl Send for AgentRegistry
impl Sync for AgentRegistry
impl Unpin for AgentRegistry
impl UnwindSafe for AgentRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more