pub struct ProviderRegistry { /* private fields */ }Expand description
A registry of named tool providers. Implements ToolDispatcher so it can
be plugged directly into the VM.
Implementations§
Source§impl ProviderRegistry
impl ProviderRegistry
pub fn new() -> Self
Sourcepub fn register(&mut self, name: &str, provider: Box<dyn ToolProvider>)
pub fn register(&mut self, name: &str, provider: Box<dyn ToolProvider>)
Register a provider under the given name, replacing any previous one.
Sourcepub fn get(&self, name: &str) -> Option<&dyn ToolProvider>
pub fn get(&self, name: &str) -> Option<&dyn ToolProvider>
Look up a provider by name.
Sourcepub fn has(&self, name: &str) -> bool
pub fn has(&self, name: &str) -> bool
Check whether a provider is registered under the given name.
Sourcepub fn unregister(&mut self, name: &str) -> bool
pub fn unregister(&mut self, name: &str) -> bool
Remove a provider by name, returning true if it existed.
Trait Implementations§
Source§impl Default for ProviderRegistry
impl Default for ProviderRegistry
Source§impl ToolDispatcher for ProviderRegistry
The registry doubles as a ToolDispatcher. It resolves request.tool_id
to a registered provider, forwards the call, and wraps the result in a
ToolResponse.
impl ToolDispatcher for ProviderRegistry
The registry doubles as a ToolDispatcher. It resolves request.tool_id
to a registered provider, forwards the call, and wraps the result in a
ToolResponse.
fn dispatch(&self, request: &ToolRequest) -> Result<ToolResponse, ToolError>
Source§fn dispatch_async<'a>(
&'a self,
request: &'a ToolRequest,
) -> ToolFuture<'a, ToolResponse>
fn dispatch_async<'a>( &'a self, request: &'a ToolRequest, ) -> ToolFuture<'a, ToolResponse>
Async dispatch hook. Read more
Auto Trait Implementations§
impl Freeze for ProviderRegistry
impl !RefUnwindSafe for ProviderRegistry
impl Send for ProviderRegistry
impl Sync for ProviderRegistry
impl Unpin for ProviderRegistry
impl !UnwindSafe for ProviderRegistry
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