pub struct TaskRegistry { /* private fields */ }Expand description
Central management layer for all observable tasks.
Sub-registries (BgRegistry, TermRegistry, Executor, agent_ctrl) register
tasks here on spawn and call finish when the task ends. Typed operations
(bash.output, term.input, term.capture) stay on the sub-registries and are
looked up by source_handle.
Implementations§
Source§impl TaskRegistry
impl TaskRegistry
pub fn new() -> Self
pub fn register( &self, kind: TaskKind, label: String, source_handle: String, session_id: String, cancel: CancellationToken, ) -> TaskId
pub fn register_with_kill_hook( &self, kind: TaskKind, label: String, source_handle: String, session_id: String, cancel: CancellationToken, kill_hook: Option<Arc<dyn Fn() + Send + Sync>>, ) -> TaskId
pub fn lookup(&self, id: &TaskId) -> Option<TaskSnapshot>
Sourcepub fn lookup_by_handle(&self, handle: &str) -> Option<TaskSnapshot>
pub fn lookup_by_handle(&self, handle: &str) -> Option<TaskSnapshot>
Find a task by its source handle (e.g. “bg_1”, “term_2”, run_id).
pub fn list(&self, filter: &TaskFilter) -> Vec<TaskSnapshot>
pub fn kill(&self, id: &TaskId) -> bool
Sourcepub fn finish(&self, id: &TaskId, status: TaskStatus)
pub fn finish(&self, id: &TaskId, status: TaskStatus)
Transition a task to a terminal status. Called by the owning sub-registry when the task finishes.
pub fn reap(&self, id: &TaskId)
pub fn subscribe(&self) -> Receiver<TaskEvent>
pub fn running_count(&self) -> usize
Trait Implementations§
Source§impl Clone for TaskRegistry
impl Clone for TaskRegistry
Source§fn clone(&self) -> TaskRegistry
fn clone(&self) -> TaskRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TaskRegistry
impl RefUnwindSafe for TaskRegistry
impl Send for TaskRegistry
impl Sync for TaskRegistry
impl Unpin for TaskRegistry
impl UnsafeUnpin for TaskRegistry
impl UnwindSafe for TaskRegistry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.