pub struct ProcessRegistry { /* private fields */ }Expand description
Registry of active processes.
Tracks running commands by id. One-shot processes are removed when they complete; background processes remain until explicitly removed or cancelled.
Wired into the live app: background run_shell results are registered
here, the :bg command lists them, and cancel_all runs on quit.
Implementations§
Source§impl ProcessRegistry
impl ProcessRegistry
Sourcepub fn register(
&self,
command: Vec<String>,
cwd: PathBuf,
kind: ProcessKind,
cancel: CancelToken,
) -> u64
pub fn register( &self, command: Vec<String>, cwd: PathBuf, kind: ProcessKind, cancel: CancelToken, ) -> u64
Register a new process and return its id.
Sourcepub fn get(&self, id: u64) -> Option<ActiveProcess>
pub fn get(&self, id: u64) -> Option<ActiveProcess>
Look up an active process by id.
Sourcepub fn cancel(&self, id: u64) -> bool
pub fn cancel(&self, id: u64) -> bool
Request cancellation of a process by id.
Returns true if the process existed and cancellation was signalled.
Sourcepub fn remove(&self, id: u64) -> Option<ActiveProcess>
pub fn remove(&self, id: u64) -> Option<ActiveProcess>
Remove a completed process from the registry.
Sourcepub fn cancel_all(&self)
pub fn cancel_all(&self)
Cancel all active processes.
Sourcepub fn background_ids(&self) -> impl Iterator<Item = u64>
pub fn background_ids(&self) -> impl Iterator<Item = u64>
Iterate over active background process ids.
Sourcepub fn announce(&self, id: u64) -> bool
pub fn announce(&self, id: u64) -> bool
Mark an application-visible background process as announced.
Sourcepub fn drain_completed(&self) -> Vec<ProcessResult>
pub fn drain_completed(&self) -> Vec<ProcessResult>
Return completed background results after their start event was observed.
Sourcepub fn shutdown(&self) -> Vec<ProcessResult>
pub fn shutdown(&self) -> Vec<ProcessResult>
Cancel and reap every owned process, returning all final results.
Trait Implementations§
Source§impl Clone for ProcessRegistry
impl Clone for ProcessRegistry
Source§fn clone(&self) -> ProcessRegistry
fn clone(&self) -> ProcessRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProcessRegistry
impl Debug for ProcessRegistry
Source§impl Default for ProcessRegistry
impl Default for ProcessRegistry
Source§fn default() -> ProcessRegistry
fn default() -> ProcessRegistry
Source§impl Drop for ProcessRegistry
impl Drop for ProcessRegistry
Auto Trait Implementations§
impl Freeze for ProcessRegistry
impl RefUnwindSafe for ProcessRegistry
impl Send for ProcessRegistry
impl Sync for ProcessRegistry
impl Unpin for ProcessRegistry
impl UnsafeUnpin for ProcessRegistry
impl UnwindSafe for ProcessRegistry
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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