pub struct SessionState { /* private fields */ }Expand description
Shared session state that can be cloned across requests.
Uses atomic operations for thread-safe state transitions.
Implementations§
Source§impl SessionState
impl SessionState
Sourcepub fn phase(&self) -> SessionPhase
pub fn phase(&self) -> SessionPhase
Get the current session phase
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check if the session is initialized (operation phase)
Sourcepub fn mark_initializing(&self) -> bool
pub fn mark_initializing(&self) -> bool
Transition from Uninitialized to Initializing.
Called after responding to an initialize request.
Returns true if the transition was successful.
Sourcepub fn mark_initialized(&self) -> bool
pub fn mark_initialized(&self) -> bool
Transition from Initializing to Initialized.
Called when receiving an initialized notification.
Returns true if the transition was successful.
Sourcepub fn is_request_allowed(&self, method: &str) -> bool
pub fn is_request_allowed(&self, method: &str) -> bool
Check if a request method is allowed in the current phase. Per spec:
- Before initialization: only
initializeandpingare valid - During all phases:
pingis always valid
Trait Implementations§
Source§impl Clone for SessionState
impl Clone for SessionState
Source§fn clone(&self) -> SessionState
fn clone(&self) -> SessionState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SessionState
impl RefUnwindSafe for SessionState
impl Send for SessionState
impl Sync for SessionState
impl Unpin for SessionState
impl UnwindSafe for SessionState
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