pub struct LlmContextGuard { /* private fields */ }Expand description
RAII guard for LLM context
When this guard is dropped, the LLM context is automatically cleared. This ensures exception-safe cleanup and prevents forgetting to clear context.
§Example
ⓘ
{
let _guard = set_llm_context_scoped("gpt-4", "openai_client");
log::info!("This will have LLM context");
}
log::info!("This will NOT have LLM context");Trait Implementations§
Source§impl Drop for LlmContextGuard
impl Drop for LlmContextGuard
Auto Trait Implementations§
impl Forget for LlmContextGuard
impl Freeze for LlmContextGuard
impl Move for LlmContextGuard
impl RefUnwindSafe for LlmContextGuard
impl Send for LlmContextGuard
impl Sync for LlmContextGuard
impl Unpin for LlmContextGuard
impl UnsafeUnpin for LlmContextGuard
impl UnwindSafe for LlmContextGuard
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