pub struct ToolRegistry { /* private fields */ }Expand description
Registry of all available tools, organized by Gana.
Wraps inner state in Arc so the registry can be cheaply cloned
and shared between the dispatch pipeline, MCP server, and meta-tools.
Implementations§
Source§impl ToolRegistry
impl ToolRegistry
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Create a new empty registry with pre-allocated capacity.
Sourcepub fn register(&self, tool: Arc<dyn Tool>) -> Self
pub fn register(&self, tool: Arc<dyn Tool>) -> Self
Register a tool. Returns a new registry (immutable, Arc-shared).
Since the inner state is Arc-shared, this method is on &self
and returns a new ToolRegistry with the tool added.
For bulk registration, use ToolRegistryBuilder instead.
Sourcepub fn get(&self, name: &str) -> Option<Arc<dyn Tool>>
pub fn get(&self, name: &str) -> Option<Arc<dyn Tool>>
Get a tool by name. Returns an owned Arc<dyn Tool> clone.
Sourcepub fn by_gana(&self, gana: Gana) -> Vec<Arc<dyn Tool>>
pub fn by_gana(&self, gana: Gana) -> Vec<Arc<dyn Tool>>
Get all tools for a Gana. Returns owned Arc<dyn Tool> clones.
Sourcepub fn all_ref(&self) -> &[Arc<dyn Tool>]
pub fn all_ref(&self) -> &[Arc<dyn Tool>]
Get all registered tools as a slice reference (no clone).
Sourcepub fn available_in(&self, brain_wave: BrainWave) -> Vec<Arc<dyn Tool>>
pub fn available_in(&self, brain_wave: BrainWave) -> Vec<Arc<dyn Tool>>
Get all tools available in the given brain-wave state.
Filters tools by their EffectRow::is_available_in() check.
In Alpha/Theta/Delta modes, write-heavy and expensive tools are excluded.
Sourcepub fn available_count(&self, brain_wave: BrainWave) -> usize
pub fn available_count(&self, brain_wave: BrainWave) -> usize
Count tools available in the given brain-wave state.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more