pub struct SessionData {
pub sid: SessionId,
pub name: String,
pub role: ClientRole,
pub office_id: Option<OfficeId>,
pub extra: Value,
}Expand description
会话数据
Fields§
§sid: SessionId会话 ID
name: String客户端名称
role: ClientRole客户端角色
office_id: Option<OfficeId>当前所在的办公室 ID
extra: Value其他扩展数据
Implementations§
Source§impl SessionData
impl SessionData
Sourcepub fn new(sid: SessionId, name: String, role: ClientRole) -> Self
pub fn new(sid: SessionId, name: String, role: ClientRole) -> Self
创建新的会话数据
Sourcepub fn with_office_id(self, office_id: OfficeId) -> Self
pub fn with_office_id(self, office_id: OfficeId) -> Self
设置办公室 ID
Sourcepub fn with_extra(self, extra: Value) -> Self
pub fn with_extra(self, extra: Value) -> Self
设置扩展数据
Trait Implementations§
Source§impl Clone for SessionData
impl Clone for SessionData
Source§fn clone(&self) -> SessionData
fn clone(&self) -> SessionData
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 moreSource§impl Debug for SessionData
impl Debug for SessionData
Source§impl<'de> Deserialize<'de> for SessionData
impl<'de> Deserialize<'de> for SessionData
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SessionData
impl RefUnwindSafe for SessionData
impl Send for SessionData
impl Sync for SessionData
impl Unpin for SessionData
impl UnsafeUnpin for SessionData
impl UnwindSafe for SessionData
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