pub struct Session {
pub id: u64,
pub protocol: ProtocolVersion,
pub created_at: u64,
pub last_activity: AtomicU64,
pub data: RwLock<HashMap<String, Vec<u8>>>,
pub message_count: AtomicU64,
}Expand description
Session state for a connected client
Fields§
§id: u64Unique session ID
protocol: ProtocolVersionCurrent protocol version
created_at: u64Session creation timestamp
last_activity: AtomicU64Last activity timestamp
data: RwLock<HashMap<String, Vec<u8>>>Custom session data
message_count: AtomicU64Message count
Implementations§
Source§impl Session
impl Session
Sourcepub fn increment_messages(&self) -> u64
pub fn increment_messages(&self) -> u64
Increment message count
Sourcepub fn upgrade_protocol(&mut self, version: ProtocolVersion)
pub fn upgrade_protocol(&mut self, version: ProtocolVersion)
Upgrade protocol version
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
impl UnwindSafe for Session
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