pub struct HookFactory { /* private fields */ }Expand description
Factory for creating agent-specific hooks
The factory maintains a registry of supported agent types and creates the appropriate hook implementation for each.
§Example
use nexus_hooks::HookFactory;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let factory = HookFactory::new();
// Create hook for specific agent
let hook = factory.create_hook("claude-code")?;
let hook = factory.create_hook("pi-mono")?;
let hook = factory.create_hook("oh-my-pi")?;
// List supported agents
for agent in factory.supported_agents() {
println!("Supported: {}", agent);
}
Ok(())
}Implementations§
Source§impl HookFactory
impl HookFactory
Sourcepub fn create_hook(&self, agent_type: &str) -> Result<Box<dyn AgentHook>>
pub fn create_hook(&self, agent_type: &str) -> Result<Box<dyn AgentHook>>
Create a hook for the specified agent type
Sourcepub fn is_supported(&self, agent_type: &str) -> bool
pub fn is_supported(&self, agent_type: &str) -> bool
Check if an agent type is supported
Sourcepub fn supported_agents(&self) -> Vec<String>
pub fn supported_agents(&self) -> Vec<String>
Get list of supported agent types
Sourcepub fn get_agent_info(&self, agent_type: &str) -> Option<AgentInfo>
pub fn get_agent_info(&self, agent_type: &str) -> Option<AgentInfo>
Get agent type info
Sourcepub fn register_alias(&mut self, alias: &str, target: &str)
pub fn register_alias(&mut self, alias: &str, target: &str)
Register a custom alias
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HookFactory
impl RefUnwindSafe for HookFactory
impl Send for HookFactory
impl Sync for HookFactory
impl Unpin for HookFactory
impl UnsafeUnpin for HookFactory
impl UnwindSafe for HookFactory
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
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>
Converts
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>
Converts
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