pub enum HookInput {
ToolUse(ToolUseHookInput),
SessionStart(SessionStartHookInput),
}Expand description
The complete hook input received from an agent via stdin.
Variants§
ToolUse(ToolUseHookInput)
PreToolUse, PostToolUse, PermissionRequest events
SessionStart(SessionStartHookInput)
SessionStart events
Implementations§
Source§impl HookInput
impl HookInput
Sourcepub fn from_reader(reader: impl Read) -> Result<Self>
pub fn from_reader(reader: impl Read) -> Result<Self>
Parse from any reader (for testability).
Sourcepub fn from_stdin() -> Result<Self>
pub fn from_stdin() -> Result<Self>
Parse from stdin (convenience wrapper for production).
Sourcepub fn hook_event_name(&self) -> &str
pub fn hook_event_name(&self) -> &str
Get the hook event name.
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Get the session ID.
Sourcepub fn as_tool_use(&self) -> Option<&ToolUseHookInput>
pub fn as_tool_use(&self) -> Option<&ToolUseHookInput>
Check if this is a tool use event.
Sourcepub fn as_session_start(&self) -> Option<&SessionStartHookInput>
pub fn as_session_start(&self) -> Option<&SessionStartHookInput>
Check if this is a session start event.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for HookInput
impl<'de> Deserialize<'de> for HookInput
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for HookInput
impl RefUnwindSafe for HookInput
impl Send for HookInput
impl Sync for HookInput
impl Unpin for HookInput
impl UnsafeUnpin for HookInput
impl UnwindSafe for HookInput
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