pub struct ToolRegistryCache { /* private fields */ }Implementations§
Source§impl ToolRegistryCache
impl ToolRegistryCache
pub fn new() -> Self
Sourcepub fn get_or_build(
&self,
agent_id: &str,
binding_index: Option<usize>,
base: &ToolRegistry,
allowed_tools: &[String],
) -> Arc<ToolRegistry> ⓘ
pub fn get_or_build( &self, agent_id: &str, binding_index: Option<usize>, base: &ToolRegistry, allowed_tools: &[String], ) -> Arc<ToolRegistry> ⓘ
Returns the cached registry for (agent_id, binding_index),
building it with base.filtered_clone(allowed_tools) on first
access. binding_index = None is reserved for the legacy
“no bindings” slot so the real-binding key space (0..N) stays
disjoint from it.
Sourcepub fn get_or_build_with_dispatch(
&self,
agent_id: &str,
binding_index: Option<usize>,
base: &ToolRegistry,
allowed_tools: &[String],
dispatch_policy: &DispatchPolicy,
is_admin: bool,
) -> Arc<ToolRegistry> ⓘ
pub fn get_or_build_with_dispatch( &self, agent_id: &str, binding_index: Option<usize>, base: &ToolRegistry, allowed_tools: &[String], dispatch_policy: &DispatchPolicy, is_admin: bool, ) -> Arc<ToolRegistry> ⓘ
Per-binding registry filtered by both the
agent’s allowed_tools AND the resolved DispatchPolicy.
First call builds it; subsequent calls return the cached
Arc. Hot-reload safety: every reload constructs a fresh
RuntimeSnapshot carrying a fresh ToolRegistryCache, so a
new dispatch_policy / is_admin combination produces a fresh
filtered registry without an explicit invalidation step.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of cached filtered registries. Exposed for tests and diagnostics.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for ToolRegistryCache
impl Clone for ToolRegistryCache
Source§fn clone(&self) -> ToolRegistryCache
fn clone(&self) -> ToolRegistryCache
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for ToolRegistryCache
impl Default for ToolRegistryCache
Source§fn default() -> ToolRegistryCache
fn default() -> ToolRegistryCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for ToolRegistryCache
impl !UnwindSafe for ToolRegistryCache
impl Freeze for ToolRegistryCache
impl Send for ToolRegistryCache
impl Sync for ToolRegistryCache
impl Unpin for ToolRegistryCache
impl UnsafeUnpin for ToolRegistryCache
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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