pub struct Toolbox { /* private fields */ }Implementations§
Source§impl Toolbox
impl Toolbox
pub fn new() -> Self
Sourcepub fn register(&mut self, tool: Arc<dyn Tool>) -> Result<(), ToolError>
pub fn register(&mut self, tool: Arc<dyn Tool>) -> Result<(), ToolError>
Register a tool. Names that the hard exposure rules forbid are refused here, so they cannot even be listed.
pub fn register_all( &mut self, tools: Vec<Arc<dyn Tool>>, ) -> Result<(), ToolError>
Sourcepub fn allow<I: IntoIterator<Item = S>, S: Into<String>>(
&mut self,
caller: &str,
patterns: I,
) -> &mut Self
pub fn allow<I: IntoIterator<Item = S>, S: Into<String>>( &mut self, caller: &str, patterns: I, ) -> &mut Self
Let caller use tools matching patterns (*, prefix*, exact; see [pattern_matches]).
pub fn set_admission(&mut self, hook: Arc<dyn ToolAdmission>) -> &mut Self
pub fn add_journal(&mut self, j: Arc<dyn Journal>) -> &mut Self
pub fn metrics(&self) -> Metrics
Sourcepub fn list_for(&self, caller: &str) -> Vec<ToolSpec>
pub fn list_for(&self, caller: &str) -> Vec<ToolSpec>
Specs visible to caller: only tools it may call at all (subject-carrying
tools are listed when any pattern could match them).
pub fn list_all(&self) -> Vec<ToolSpec>
pub fn call( &self, caller: &Caller, name: &str, args: Value, ) -> Result<Value, ToolError>
pub fn call_cancellable( &self, caller: &Caller, name: &str, args: Value, cancel: &CancelToken, ) -> Result<Value, ToolError>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Toolbox
impl !RefUnwindSafe for Toolbox
impl !UnwindSafe for Toolbox
impl Send for Toolbox
impl Sync for Toolbox
impl Unpin for Toolbox
impl UnsafeUnpin for Toolbox
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