pub struct SessionManager {
pub widget: SessionWidget,
pub storage: HashMap<String, SessionData>,
/* private fields */
}Expand description
Session manager for handling session lifecycle
Fields§
§widget: SessionWidgetSession widget
storage: HashMap<String, SessionData>Session storage (ID -> Session data)
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn create_session(&mut self, name: String) -> Result<String>
pub fn create_session(&mut self, name: String) -> Result<String>
Create a new session
Sourcepub fn delete_session(&mut self, id: &str) -> Result<()>
pub fn delete_session(&mut self, id: &str) -> Result<()>
Delete a session by ID
Sourcepub fn switch_session(&mut self, id: &str) -> Result<()>
pub fn switch_session(&mut self, id: &str) -> Result<()>
Switch to a session
Sourcepub fn current_session_id(&self) -> Option<String>
pub fn current_session_id(&self) -> Option<String>
Get the current session ID
Sourcepub fn current_session_name(&self) -> Option<String>
pub fn current_session_name(&self) -> Option<String>
Get the current session name
Sourcepub fn add_message_to_current(&mut self, message: &str) -> Result<()>
pub fn add_message_to_current(&mut self, message: &str) -> Result<()>
Add a message to the current session
Sourcepub fn get_session_content(&self, id: &str) -> Option<String>
pub fn get_session_content(&self, id: &str) -> Option<String>
Get session content
Sourcepub fn all_session_ids(&self) -> Vec<String>
pub fn all_session_ids(&self) -> Vec<String>
Get all session IDs
Sourcepub fn all_session_names(&self) -> Vec<String>
pub fn all_session_names(&self) -> Vec<String>
Get all session names
Sourcepub fn session_count(&self) -> usize
pub fn session_count(&self) -> usize
Get session count
Sourcepub fn has_sessions(&self) -> bool
pub fn has_sessions(&self) -> bool
Check if there are any sessions
Sourcepub fn clear_all_sessions(&mut self)
pub fn clear_all_sessions(&mut self)
Clear all sessions
Sourcepub fn get_session(&self, id: &str) -> Option<&Session>
pub fn get_session(&self, id: &str) -> Option<&Session>
Get session by ID
Sourcepub fn get_session_data(&self, id: &str) -> Option<&SessionData>
pub fn get_session_data(&self, id: &str) -> Option<&SessionData>
Get session data by ID
Sourcepub fn mark_session_dirty(&mut self, id: &str) -> Result<()>
pub fn mark_session_dirty(&mut self, id: &str) -> Result<()>
Mark session as dirty
Sourcepub fn mark_session_clean(&mut self, id: &str) -> Result<()>
pub fn mark_session_clean(&mut self, id: &str) -> Result<()>
Mark session as clean
Sourcepub fn widget(&self) -> &SessionWidget
pub fn widget(&self) -> &SessionWidget
Get the widget reference
Sourcepub fn widget_mut(&mut self) -> &mut SessionWidget
pub fn widget_mut(&mut self) -> &mut SessionWidget
Get mutable widget reference
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SessionManager
impl RefUnwindSafe for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin for SessionManager
impl UnwindSafe for SessionManager
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more