pub struct SessionStateGuard { /* private fields */ }Expand description
RAII guard that automatically cleans up session state when dropped.
This is the recommended way to manage session state lifetime. Create a guard at the start of a session and let it clean up automatically when the session ends.
§Example
ⓘ
use turbomcp_protocol::context::SessionStateGuard;
async fn handle_connection(session_id: String) {
let _guard = SessionStateGuard::new(&session_id);
// Session state is available for this session_id
// ...
} // State automatically cleaned up hereImplementations§
Trait Implementations§
Source§impl Debug for SessionStateGuard
impl Debug for SessionStateGuard
Auto Trait Implementations§
impl Freeze for SessionStateGuard
impl RefUnwindSafe for SessionStateGuard
impl Send for SessionStateGuard
impl Sync for SessionStateGuard
impl Unpin for SessionStateGuard
impl UnsafeUnpin for SessionStateGuard
impl UnwindSafe for SessionStateGuard
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