pub struct ThreadList { /* private fields */ }Expand description
The user’s threads, with one main thread shown at a time.
Implementations§
Source§impl ThreadList
impl ThreadList
Sourcepub fn new(
factory: impl Fn(&str) -> Rc<dyn ThreadRuntime> + 'static,
spawner: Spawner,
adapter: Option<Rc<dyn ThreadListAdapter>>,
) -> Self
pub fn new( factory: impl Fn(&str) -> Rc<dyn ThreadRuntime> + 'static, spawner: Spawner, adapter: Option<Rc<dyn ThreadListAdapter>>, ) -> Self
A list with one empty new thread as the main thread. With an adapter, the stored threads are fetched in the background.
Sourcepub fn subscribe(&self, callback: impl Fn() + 'static) -> Subscription
pub fn subscribe(&self, callback: impl Fn() + 'static) -> Subscription
Called after every change. Drop the guard to unsubscribe.
Sourcepub fn items(&self) -> Vec<ThreadItem>
pub fn items(&self) -> Vec<ThreadItem>
Every thread, in list order (new first, then as fetched or created).
Sourcepub fn regular(&self) -> Vec<ThreadItem>
pub fn regular(&self) -> Vec<ThreadItem>
The threads in the main list.
Sourcepub fn archived(&self) -> Vec<ThreadItem>
pub fn archived(&self) -> Vec<ThreadItem>
The archived threads.
Sourcepub fn item(&self, id: &str) -> Option<ThreadItem>
pub fn item(&self, id: &str) -> Option<ThreadItem>
One thread, by local id.
Sourcepub fn main(&self) -> Rc<dyn ThreadRuntime>
pub fn main(&self) -> Rc<dyn ThreadRuntime>
The main thread’s runtime, created on first use.
Sourcepub fn runtime(&self, id: &str) -> Option<Rc<dyn ThreadRuntime>>
pub fn runtime(&self, id: &str) -> Option<Rc<dyn ThreadRuntime>>
The runtime of any thread, created on first use.
Sourcepub fn is_loading(&self) -> bool
pub fn is_loading(&self) -> bool
The adapter is fetching the stored threads.
Sourcepub fn last_error(&self) -> Option<String>
pub fn last_error(&self) -> Option<String>
The last background failure, until the next successful change.
Sourcepub fn switch_to_new(&self)
pub fn switch_to_new(&self)
Start a fresh thread, or return to the empty one already there.
Sourcepub fn switch_to(&self, id: &str)
pub fn switch_to(&self, id: &str)
Make a thread the main thread; a stored thread loads its history.
Sourcepub fn rename(&self, id: &str, title: &str)
pub fn rename(&self, id: &str, title: &str)
Rename a thread. The change shows at once and is undone if the adapter fails.
Sourcepub fn archive(&self, id: &str)
pub fn archive(&self, id: &str)
Archive a thread. The change shows at once and is undone if the adapter fails.