pub struct BeforeRequestContext<'a, T = ()> {
pub operation: &'a str,
pub model: &'a str,
pub request_json: &'a str,
pub state: &'a mut T,
}Expand description
Context provided before a request is sent.
This context contains all the information about the request that’s about to be made, and allows interceptors to store state that will be carried through the request lifecycle.
The generic type parameter T allows interceptors to define their own
state type for passing data between lifecycle hooks.
Fields§
§operation: &'a strThe operation being performed (e.g., “chat”, “embedding”, “image_generation”)
model: &'a strThe model being used for the request
request_json: &'a strThe serialized request body as JSON
state: &'a mut TTyped state for passing data between interceptor hooks
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for BeforeRequestContext<'a, T>
impl<'a, T> RefUnwindSafe for BeforeRequestContext<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for BeforeRequestContext<'a, T>where
T: Send,
impl<'a, T> Sync for BeforeRequestContext<'a, T>where
T: Sync,
impl<'a, T> Unpin for BeforeRequestContext<'a, T>
impl<'a, T = ()> !UnwindSafe for BeforeRequestContext<'a, 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