pub struct InternalToolRegistry { /* private fields */ }Expand description
Registry of internal tools, keyed by name.
Stores tools as Arc<dyn InternalTool> for cheap cloning and
shared ownership across cognitive graph nodes.
§Example
use pe_core::internal_tool::InternalToolRegistry;
let registry = InternalToolRegistry::new();
assert!(registry.is_empty());
assert_eq!(registry.len(), 0);Implementations§
Source§impl InternalToolRegistry
impl InternalToolRegistry
Sourcepub fn register(&mut self, tool: Arc<dyn InternalTool>) -> &mut Self
pub fn register(&mut self, tool: Arc<dyn InternalTool>) -> &mut Self
Register an internal tool. Overwrites any existing tool with the same name.
Sourcepub fn unregister(&mut self, name: &str) -> Option<Arc<dyn InternalTool>>
pub fn unregister(&mut self, name: &str) -> Option<Arc<dyn InternalTool>>
Remove a tool by name. Returns the removed tool if it existed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InternalToolRegistry
impl !RefUnwindSafe for InternalToolRegistry
impl Send for InternalToolRegistry
impl Sync for InternalToolRegistry
impl Unpin for InternalToolRegistry
impl UnsafeUnpin for InternalToolRegistry
impl !UnwindSafe for InternalToolRegistry
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