pub struct HCons<Head, Tail> {
pub head: Head,
pub tail: Tail,
}Expand description
Heterogeneous list cons cell for composing hooks at compile time.
This allows chaining multiple hooks together without boxing or dynamic dispatch.
§Example
ⓘ
let agent = Agent::builder(llm)
.hook(LoggingHook)
.hook(ConfirmationHook)
.build();
// Creates Agent<LLM, HCons<ConfirmationHook, HCons<LoggingHook, ()>>>Fields§
§head: HeadThe first hook in the chain.
tail: TailThe remaining hooks.
Implementations§
Trait Implementations§
impl<Head: Copy, Tail: Copy> Copy for HCons<Head, Tail>
Source§impl<Head, Tail> Hook for HCons<Head, Tail>
impl<Head, Tail> Hook for HCons<Head, Tail>
Source§async fn pre_tool_use(&self, ctx: &ToolUseContext<'_>) -> PreToolAction
async fn pre_tool_use(&self, ctx: &ToolUseContext<'_>) -> PreToolAction
Called before a tool is executed. Read more
Source§async fn post_tool_use(&self, ctx: &ToolResultContext<'_>) -> PostToolAction
async fn post_tool_use(&self, ctx: &ToolResultContext<'_>) -> PostToolAction
Called after a tool is executed. Read more
Source§async fn on_stop(&self, ctx: &StopContext<'_>) -> Option<String>
async fn on_stop(&self, ctx: &StopContext<'_>) -> Option<String>
Called when the agent is about to stop. Read more
Source§async fn on_turn_boundary(
&self,
ctx: &TurnBoundaryContext<'_>,
) -> TurnBoundaryAction
async fn on_turn_boundary( &self, ctx: &TurnBoundaryContext<'_>, ) -> TurnBoundaryAction
Called after a full tool/result cycle is committed into agent memory,
before the next model request begins.
Source§async fn on_checkpoint(&self, ctx: &CheckpointContext<'_>) -> Option<String>
async fn on_checkpoint(&self, ctx: &CheckpointContext<'_>) -> Option<String>
Called when the runtime emits a structured checkpoint. Read more
Auto Trait Implementations§
impl<Head, Tail> Freeze for HCons<Head, Tail>
impl<Head, Tail> RefUnwindSafe for HCons<Head, Tail>where
Head: RefUnwindSafe,
Tail: RefUnwindSafe,
impl<Head, Tail> Send for HCons<Head, Tail>
impl<Head, Tail> Sync for HCons<Head, Tail>
impl<Head, Tail> Unpin for HCons<Head, Tail>
impl<Head, Tail> UnsafeUnpin for HCons<Head, Tail>where
Head: UnsafeUnpin,
Tail: UnsafeUnpin,
impl<Head, Tail> UnwindSafe for HCons<Head, Tail>where
Head: UnwindSafe,
Tail: UnwindSafe,
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
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> 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