pub enum Decision<R> {
Continue,
Reject(Rejection),
ShortCircuit(R),
}Expand description
The verdict a middleware hook returns.
R is the result type of the intercepted operation: NodeOutput for
node runs, ChatResponse for model calls, Value for tool calls.
Variants§
Continue
Continue through the chain (any mutations applied to the context in place propagate to the next layer and the operation).
Reject(Rejection)
Stop the chain and fail the operation with a structured reason.
ShortCircuit(R)
Before-hook: skip the remaining before-hooks and the operation
itself; R stands in for its result while the entered layers unwind.
After-hook: replace the result with R and skip the remaining
(outer) after-hooks.
Trait Implementations§
impl<R: PartialEq> StructuralPartialEq for Decision<R>
Auto Trait Implementations§
impl<R> Freeze for Decision<R>where
R: Freeze,
impl<R> RefUnwindSafe for Decision<R>where
R: RefUnwindSafe,
impl<R> Send for Decision<R>where
R: Send,
impl<R> Sync for Decision<R>where
R: Sync,
impl<R> Unpin for Decision<R>where
R: Unpin,
impl<R> UnsafeUnpin for Decision<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for Decision<R>where
R: 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