pub struct SaSession {
pub id: String,
pub create_time: DateTime<Utc>,
pub data: HashMap<String, Value>,
}Expand description
Session 对象 | Session Object
用于存储用户会话数据的对象 Object for storing user session data
§字段说明 | Field Description
id: Session 唯一标识 | Session unique identifiercreate_time: 创建时间 | Creation timedata: 存储的键值对数据 | Stored key-value data
§使用示例 | Usage Example
ⓘ
let mut session = SaSession::new("session_123");
session.set("username", "张三")?;
session.set("age", 25)?;
let username: Option<String> = session.get("username");
println!("Username: {:?}", username);Fields§
§id: StringSession ID
create_time: DateTime<Utc>创建时间 | Creation time
data: HashMap<String, Value>数据存储 | Data storage
Implementations§
Source§impl SaSession
impl SaSession
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SaSession
impl<'de> Deserialize<'de> for SaSession
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 SaSession
impl RefUnwindSafe for SaSession
impl Send for SaSession
impl Sync for SaSession
impl Unpin for SaSession
impl UnwindSafe for SaSession
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)