pub struct SessionIntegration {
pub manager: SessionManager,
pub widget: SessionWidget,
}Expand description
Integrates core session management with TUI display
Fields§
§manager: SessionManagerCore session manager (single source of truth)
widget: SessionWidgetTUI session widget for display
Implementations§
Source§impl SessionIntegration
impl SessionIntegration
Sourcepub fn sync_to_widget(&mut self)
pub fn sync_to_widget(&mut self)
Sync core sessions to TUI widget for display This should be called whenever sessions change to keep the UI in sync
Sourcepub fn handle_session_switch(&mut self, session_id: &str) -> Result<(), String>
pub fn handle_session_switch(&mut self, session_id: &str) -> Result<(), String>
Handle session switching from the TUI widget Updates the core manager to maintain consistency
Sourcepub fn create_session(
&mut self,
name: String,
context: SessionContext,
) -> Result<String, String>
pub fn create_session( &mut self, name: String, context: SessionContext, ) -> Result<String, String>
Create a new session and add it to the manager
Sourcepub fn delete_session(&mut self, session_id: &str) -> Result<(), String>
pub fn delete_session(&mut self, session_id: &str) -> Result<(), String>
Delete a session from the manager
Sourcepub fn active_session_id(&self) -> Option<&str>
pub fn active_session_id(&self) -> Option<&str>
Get the currently active session ID
Sourcepub fn session_count(&self) -> usize
pub fn session_count(&self) -> usize
Get the number of sessions
Sourcepub fn is_limit_reached(&self) -> bool
pub fn is_limit_reached(&self) -> bool
Check if the session limit is reached
Sourcepub fn list_sessions(&self) -> Vec<Session>
pub fn list_sessions(&self) -> Vec<Session>
Get all sessions
Sourcepub fn get_active_session(&self) -> Result<Session, String>
pub fn get_active_session(&self) -> Result<Session, String>
Get the active session
Sourcepub fn add_message_to_active(
&mut self,
message_content: &str,
) -> Result<String, String>
pub fn add_message_to_active( &mut self, message_content: &str, ) -> Result<String, String>
Add a message to the active session
Sourcepub fn add_message_to_session(
&mut self,
session_id: &str,
message_content: &str,
) -> Result<String, String>
pub fn add_message_to_session( &mut self, session_id: &str, message_content: &str, ) -> Result<String, String>
Add a message to a specific session
Sourcepub fn widget(&self) -> &SessionWidget
pub fn widget(&self) -> &SessionWidget
Get the TUI widget reference
Sourcepub fn widget_mut(&mut self) -> &mut SessionWidget
pub fn widget_mut(&mut self) -> &mut SessionWidget
Get mutable TUI widget reference
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SessionIntegration
impl RefUnwindSafe for SessionIntegration
impl Send for SessionIntegration
impl Sync for SessionIntegration
impl Unpin for SessionIntegration
impl UnwindSafe for SessionIntegration
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