pub struct DynamicRegistry { /* private fields */ }Expand description
A mutable tool registry supporting runtime add/remove/toggle.
Uses RwLock for interior mutability, making it safe for concurrent access.
§Example
use traitclaw_core::registries::DynamicRegistry;
use traitclaw_core::traits::tool_registry::ToolRegistry;
let registry = DynamicRegistry::new();
assert!(registry.is_empty());Implementations§
Source§impl DynamicRegistry
impl DynamicRegistry
Sourcepub fn with_tools(tools: Vec<Arc<dyn ErasedTool>>) -> Self
pub fn with_tools(tools: Vec<Arc<dyn ErasedTool>>) -> Self
Create a registry pre-loaded with tools (all enabled).
Trait Implementations§
Source§impl Default for DynamicRegistry
impl Default for DynamicRegistry
Source§impl ToolRegistry for DynamicRegistry
impl ToolRegistry for DynamicRegistry
Source§fn register(&self, tool: Arc<dyn ErasedTool>) -> bool
fn register(&self, tool: Arc<dyn ErasedTool>) -> bool
Register a new tool. Returns
true if the tool was added. Read moreSource§fn unregister(&self, name: &str) -> bool
fn unregister(&self, name: &str) -> bool
Unregister a tool by name. Returns
true if the tool was removed. Read moreSource§fn set_enabled(&self, name: &str, enabled: bool) -> bool
fn set_enabled(&self, name: &str, enabled: bool) -> bool
Enable or disable a tool by name. Returns
true if the state changed. Read moreSource§fn is_enabled(&self, name: &str) -> bool
fn is_enabled(&self, name: &str) -> bool
Check if a tool is currently enabled.
Auto Trait Implementations§
impl !Freeze for DynamicRegistry
impl RefUnwindSafe for DynamicRegistry
impl Send for DynamicRegistry
impl Sync for DynamicRegistry
impl Unpin for DynamicRegistry
impl UnsafeUnpin for DynamicRegistry
impl UnwindSafe for DynamicRegistry
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