pub struct ToolRegistry { /* private fields */ }Expand description
Every registered tool, in registration order, and the active set.
Implementations§
Source§impl ToolRegistry
impl ToolRegistry
Sourcepub fn new(tools: Vec<RegisteredTool>, active: Vec<String>) -> ToolRegistry
pub fn new(tools: Vec<RegisteredTool>, active: Vec<String>) -> ToolRegistry
tools registered, with active the active names among them.
Sourcepub fn restrict(&mut self, allowed: Option<Vec<String>>, excluded: Vec<String>)
pub fn restrict(&mut self, allowed: Option<Vec<String>>, excluded: Vec<String>)
Allows only allowed (every name when None) minus excluded, and
removes registered tools outside them.
Sourcepub fn is_allowed(&self, name: &str) -> bool
pub fn is_allowed(&self, name: &str) -> bool
pi’s _isAllowedTool.
Sourcepub fn register(&mut self, tool: RegisteredTool)
pub fn register(&mut self, tool: RegisteredTool)
Registers or replaces a tool, then updates the active set.
Sourcepub fn set_active(&mut self, names: Vec<String>)
pub fn set_active(&mut self, names: Vec<String>)
Activates exactly names, ignoring unknown and hidden ones. Pending
names are dropped when a previously active tool is deactivated.
Sourcepub fn restore(&mut self, names: Vec<String>)
pub fn restore(&mut self, names: Vec<String>)
Activates names as a transcript recorded them. Names of tools not
registered yet activate when they are.
Sourcepub fn declared(&self) -> Vec<RegisteredTool>
pub fn declared(&self) -> Vec<RegisteredTool>
The active tools, as declared to the model.
Sourcepub fn all(&self) -> Vec<RegisteredTool>
pub fn all(&self) -> Vec<RegisteredTool>
Every registered tool, in registration order.
Sourcepub fn get(&self, name: &str) -> Option<&RegisteredTool>
pub fn get(&self, name: &str) -> Option<&RegisteredTool>
The tool named name.
Trait Implementations§
Source§impl Clone for ToolRegistry
impl Clone for ToolRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for ToolRegistry
impl !UnwindSafe for ToolRegistry
impl Freeze for ToolRegistry
impl Send for ToolRegistry
impl Sync for ToolRegistry
impl Unpin for ToolRegistry
impl UnsafeUnpin for ToolRegistry
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