pub struct StateScopeRegistry { /* private fields */ }Expand description
Registry mapping StateSpec types to their declared StateScope and path.
Built once at agent construction by calling
[AgentBehavior::register_state_scopes] on each behavior. The loop then
uses [resolve] to determine the effective scope of any AnyStateAction,
overriding the action-carried default when a registered type provides a
canonical scope.
Also exposes [run_scoped_paths] for enumerating all Run-scoped state
paths, enabling framework-driven cleanup at the start of each run.
Implementations§
Source§impl StateScopeRegistry
impl StateScopeRegistry
pub fn new() -> Self
Sourcepub fn register<S: StateSpec>(&mut self, scope: StateScope)
pub fn register<S: StateSpec>(&mut self, scope: StateScope)
Register a StateSpec type with an explicit StateScope.
Sourcepub fn scope_for_type_id(&self, type_id: TypeId) -> Option<StateScope>
pub fn scope_for_type_id(&self, type_id: TypeId) -> Option<StateScope>
Look up the scope of a registered type.
Sourcepub fn run_scoped_paths(&self) -> Vec<&'static str>
pub fn run_scoped_paths(&self) -> Vec<&'static str>
Return the canonical paths of all registered Run-scoped state types.
Used by prepare_run to emit delete patches for stale run-scoped
state before starting a new run.
Sourcepub fn resolve(&self, action: &AnyStateAction) -> StateScope
pub fn resolve(&self, action: &AnyStateAction) -> StateScope
Resolve the scope of an AnyStateAction.
If the action targets a registered type, returns the registered scope.
Otherwise falls back to AnyStateAction::scope.
Trait Implementations§
Source§impl Clone for StateScopeRegistry
impl Clone for StateScopeRegistry
Source§fn clone(&self) -> StateScopeRegistry
fn clone(&self) -> StateScopeRegistry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more