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 new() -> AgentRegistry
pub fn new() -> AgentRegistry
Creates a new empty registry.
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. The agent is active in all engine modes.
Sourcepub fn register_for_mode(
&mut self,
agent: Arc<Mutex<dyn Agent>>,
priority: f32,
modes: Vec<EngineMode>,
)
pub fn register_for_mode( &mut self, agent: Arc<Mutex<dyn Agent>>, priority: f32, modes: Vec<EngineMode>, )
Registers an agent with the given priority, active only in the specified modes.
Higher priority values mean the agent is updated first.
If modes is empty, the agent is active in all modes.
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 all_ids(&self) -> Vec<AgentId>
pub fn all_ids(&self) -> Vec<AgentId>
Returns the AgentIds of every registered agent in priority order.
Used by the scheduler to seed a fresh AgentCompletionMap per frame.
Sourcepub fn initialize_all(&self, context: &mut EngineContext<'_>)
pub fn initialize_all(&self, context: &mut EngineContext<'_>)
Initializes all agents once after registration.
Calls on_initialize() on each agent in priority order, giving them
access to the engine services for caching and lane setup.
Sourcepub fn execute_all(&self, context: &mut EngineContext<'_>)
pub fn execute_all(&self, context: &mut EngineContext<'_>)
Executes all agents in priority order.
Called each frame. Each agent selects the appropriate lanes and dispatches their execution.
Sourcepub fn get_by_id(&self, id: AgentId) -> Option<Arc<Mutex<dyn Agent>>>
pub fn get_by_id(&self, id: AgentId) -> Option<Arc<Mutex<dyn Agent>>>
Returns the agent with the given ID, if registered.
Sourcepub fn collect_for_phase(
&self,
phase: ExecutionPhase,
mode: &EngineMode,
) -> Vec<(Arc<Mutex<dyn Agent>>, AgentImportance, f32, Vec<AgentDependency>)>
pub fn collect_for_phase( &self, phase: ExecutionPhase, mode: &EngineMode, ) -> Vec<(Arc<Mutex<dyn Agent>>, AgentImportance, f32, Vec<AgentDependency>)>
Collects agents that are allowed to run in the given phase and mode. Returns a list of (agent, importance, priority, dependencies).
Sourcepub fn execute_agent(
&self,
id: AgentId,
context: &mut EngineContext<'_>,
) -> bool
pub fn execute_agent( &self, id: AgentId, context: &mut EngineContext<'_>, ) -> bool
Executes a specific agent by ID.
Trait Implementations§
Source§impl Default for AgentRegistry
impl Default for AgentRegistry
Source§fn default() -> AgentRegistry
fn default() -> AgentRegistry
Auto Trait Implementations§
impl Freeze for AgentRegistry
impl RefUnwindSafe for AgentRegistry
impl Send for AgentRegistry
impl Sync for AgentRegistry
impl Unpin for AgentRegistry
impl UnsafeUnpin for AgentRegistry
impl UnwindSafe for AgentRegistry
Blanket Implementations§
§impl<T> AppLifecycle for Twhere
T: ?Sized,
impl<T> AppLifecycle for Twhere
T: ?Sized,
§fn on_start(&mut self, ctx: &mut dyn AppContext)
fn on_start(&mut self, ctx: &mut dyn AppContext)
update. Apps install their theme / fonts here.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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.