pub struct HookEntry {
pub name: String,
pub point: HookPoint,
pub callback_id: String,
}Expand description
A named hook registration that will be attached to an agent.
The callback_id is an opaque identifier used to look up the actual
Rust callback in the hook runner. This decouples serialization from
function pointers.
§Construction
Prefer HookEntry::new which validates eagerly. Direct struct
construction is allowed for deserialization but skips validation —
call HookEntry::validate before use if constructing manually.
Fields§
§name: StringDescriptive name (e.g. "safety_gate").
point: HookPointWhich lifecycle point this hook fires at.
callback_id: StringOpaque callback identifier for the hook runner to resolve.
Implementations§
Source§impl HookEntry
impl HookEntry
Sourcepub fn new(
name: impl Into<String>,
point: HookPoint,
callback_id: impl Into<String>,
) -> Result<Self, Error>
pub fn new( name: impl Into<String>, point: HookPoint, callback_id: impl Into<String>, ) -> Result<Self, Error>
Create a new hook entry, validating that name and callback_id
are non-empty.
§Errors
Returns Error::InvalidConfig
if name or callback_id is empty or whitespace-only.
§Examples
let entry = HookEntry::new("safety_gate", HookPoint::PreToolCallDecide, "cb_safety")
.expect("valid entry");
assert_eq!(entry.name, "safety_gate");Trait Implementations§
Source§impl<'de> Deserialize<'de> for HookEntry
impl<'de> Deserialize<'de> for HookEntry
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
Source§impl FromIterator<HookEntry> for HookSet
impl FromIterator<HookEntry> for HookSet
Auto Trait Implementations§
impl Freeze for HookEntry
impl RefUnwindSafe for HookEntry
impl Send for HookEntry
impl Sync for HookEntry
impl Unpin for HookEntry
impl UnsafeUnpin for HookEntry
impl UnwindSafe for HookEntry
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