pub struct ThreadManager { /* private fields */ }Expand description
Manager for task threads within a session.
Implementations§
Source§impl ThreadManager
impl ThreadManager
Sourcepub fn create_thread(&mut self, label: impl Into<String>) -> TaskId
pub fn create_thread(&mut self, label: impl Into<String>) -> TaskId
Create a new thread and make it foreground.
Sourcepub fn foreground(&self) -> Option<&TaskThread>
pub fn foreground(&self) -> Option<&TaskThread>
Get the foreground thread.
Sourcepub fn foreground_mut(&mut self) -> Option<&mut TaskThread>
pub fn foreground_mut(&mut self) -> Option<&mut TaskThread>
Get mutable foreground thread.
Sourcepub fn set_foreground_description(&mut self, description: &str)
pub fn set_foreground_description(&mut self, description: &str)
Set the description of the foreground thread.
Sourcepub fn switch_to(&mut self, id: TaskId) -> Option<TaskId>
pub fn switch_to(&mut self, id: TaskId) -> Option<TaskId>
Switch to a different thread (returns the old foreground if any).
Sourcepub fn all_threads(&self) -> Vec<&TaskThread>
pub fn all_threads(&self) -> Vec<&TaskThread>
Get all threads.
Sourcepub fn get(&self, id: TaskId) -> Option<&TaskThread>
pub fn get(&self, id: TaskId) -> Option<&TaskThread>
Get a thread by ID.
Sourcepub fn get_mut(&mut self, id: TaskId) -> Option<&mut TaskThread>
pub fn get_mut(&mut self, id: TaskId) -> Option<&mut TaskThread>
Get a thread by ID mutably.
Sourcepub fn remove(&mut self, id: TaskId) -> Option<TaskThread>
pub fn remove(&mut self, id: TaskId) -> Option<TaskThread>
Remove a thread.
Sourcepub fn build_global_context(&self) -> String
pub fn build_global_context(&self) -> String
Build combined context from all threads with share_context=true.
Sourcepub fn find_best_match(&self, message: &str) -> Option<TaskId>
pub fn find_best_match(&self, message: &str) -> Option<TaskId>
Find the best matching thread for a user message. Returns thread ID if a better match exists than current foreground. Uses keyword matching: counts label words present in message.
Sourcepub fn list_info(&self) -> Vec<ThreadInfo>
pub fn list_info(&self) -> Vec<ThreadInfo>
List thread info for display.
Source§impl ThreadManager
impl ThreadManager
Sourcepub fn save_to_file(&self, path: &Path) -> Result<()>
pub fn save_to_file(&self, path: &Path) -> Result<()>
Save thread state to a file.
Sourcepub fn load_from_file(path: &Path) -> Result<Self>
pub fn load_from_file(path: &Path) -> Result<Self>
Load thread state from a file.
Sourcepub fn load_or_default(path: &Path) -> Self
pub fn load_or_default(path: &Path) -> Self
Load from file or create new with default thread.
Trait Implementations§
Source§impl Debug for ThreadManager
impl Debug for ThreadManager
Source§impl Default for ThreadManager
impl Default for ThreadManager
Source§fn default() -> ThreadManager
fn default() -> ThreadManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ThreadManager
impl RefUnwindSafe for ThreadManager
impl Send for ThreadManager
impl Sync for ThreadManager
impl Unpin for ThreadManager
impl UnsafeUnpin for ThreadManager
impl UnwindSafe for ThreadManager
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