pub struct InterceptorStack<T: Interceptable> { /* private fields */ }Expand description
A composable stack of interceptors.
Interceptors are executed in the order they are added:
- First added = outermost = sees request first, sees response last
- Last added = innermost = sees request last, sees response first
§Example
ⓘ
use llm_stack_core::intercept::{InterceptorStack, Retry, ToolExec};
let stack = InterceptorStack::<ToolExec<()>>::new()
.with(Retry::default());Implementations§
Source§impl<T: Interceptable> InterceptorStack<T>
impl<T: Interceptable> InterceptorStack<T>
Sourcepub fn with<I: Interceptor<T> + 'static>(self, interceptor: I) -> Self
pub fn with<I: Interceptor<T> + 'static>(self, interceptor: I) -> Self
Add an interceptor to the stack.
Interceptors are executed in the order added (first = outermost).
Add a shared interceptor instance.
Useful when the same interceptor instance needs to be used across multiple stacks (e.g., for shared metrics collection).
Trait Implementations§
Source§impl<T: Interceptable> Clone for InterceptorStack<T>
impl<T: Interceptable> Clone for InterceptorStack<T>
Source§impl<T: Interceptable> Default for InterceptorStack<T>
impl<T: Interceptable> Default for InterceptorStack<T>
Auto Trait Implementations§
impl<T> Freeze for InterceptorStack<T>
impl<T> !RefUnwindSafe for InterceptorStack<T>
impl<T> Send for InterceptorStack<T>
impl<T> Sync for InterceptorStack<T>
impl<T> Unpin for InterceptorStack<T>
impl<T> !UnwindSafe for InterceptorStack<T>
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