pub struct Session {
pub id: String,
pub history: Vec<Message>,
pub metadata: Value,
pub created_at_ms: u64,
pub updated_at_ms: u64,
pub expires_at_ms: Option<u64>,
}Expand description
A long-lived conversation.
Fields§
§id: StringStable identifier (caller-supplied).
history: Vec<Message>Conversation history.
metadata: ValueFree-form metadata. Examples: user-id, tenant-id, agent name.
created_at_ms: u64Unix-millis when the session was created.
updated_at_ms: u64Unix-millis when the session was last touched.
expires_at_ms: Option<u64>Optional unix-millis after which the session is considered expired.
Implementations§
Source§impl Session
impl Session
Sourcepub fn with_metadata(self, metadata: Value) -> Self
pub fn with_metadata(self, metadata: Value) -> Self
Set metadata (replaces any existing value).
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
True if the session has expired (relative to now_millis).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
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 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