pub struct HookMiddleware { /* private fields */ }Expand description
Middleware that routes BeforeTool / AfterTool phases through the
registered HookRunner as PreToolUse / PostToolUse events.
Implementations§
Source§impl HookMiddleware
impl HookMiddleware
Sourcepub fn new(runner: Arc<dyn HookRunner>) -> Self
pub fn new(runner: Arc<dyn HookRunner>) -> Self
Wrap a HookRunner as a middleware. The runner is usually the
engine’s registered CommandHookRunner (port #16).
Sourcepub fn with_session(self, id: String, cwd: PathBuf) -> Self
pub fn with_session(self, id: String, cwd: PathBuf) -> Self
Tag every emitted HookContext with a session id + cwd so hook
scripts can identify which session triggered them.
Trait Implementations§
Source§impl Debug for HookMiddleware
impl Debug for HookMiddleware
Source§impl Middleware for HookMiddleware
impl Middleware for HookMiddleware
Source§fn phases(&self) -> Vec<MiddlewarePhase>
fn phases(&self) -> Vec<MiddlewarePhase>
Phases at which this middleware wishes to be invoked.
Source§fn handle<'a>(
&'a self,
ctx: &'a MiddlewareContext,
) -> Pin<Box<dyn Future<Output = MiddlewareResult> + Send + 'a>>
fn handle<'a>( &'a self, ctx: &'a MiddlewareContext, ) -> Pin<Box<dyn Future<Output = MiddlewareResult> + Send + 'a>>
Inspect the context for the current phase and return a result.
Auto Trait Implementations§
impl !RefUnwindSafe for HookMiddleware
impl !UnwindSafe for HookMiddleware
impl Freeze for HookMiddleware
impl Send for HookMiddleware
impl Sync for HookMiddleware
impl Unpin for HookMiddleware
impl UnsafeUnpin for HookMiddleware
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