Skip to main content

ProcessStatus

Trait ProcessStatus 

Source
pub trait ProcessStatus<T, E>
where E: Error + Send, Self: Send,
{ // Required methods fn status_entry(&self) -> T; fn status_exit(&self) -> T; fn error_type(&self) -> E; fn wrap_error<F: Error + Sync + Send + 'static>( &self, error: F, message: Option<String>, ) -> E; // Provided method fn timeout_error(&self) -> E { ... } }
Expand description

Maps a process type to the status values and errors it should produce.

Implement this trait on an enum whose variants represent the distinct processes you want to run (e.g. InitDb, StartDb, StopDb). The executor calls these methods to produce typed status/error values without knowing the concrete error type.

Required Methods§

Source

fn status_entry(&self) -> T

Returns the status value that signals the process has entered execution.

Source

fn status_exit(&self) -> T

Returns the status value that signals the process exited successfully.

Source

fn error_type(&self) -> E

Returns the error value for a generic process failure (non-zero exit, spawn error, etc.).

Source

fn wrap_error<F: Error + Sync + Send + 'static>( &self, error: F, message: Option<String>, ) -> E

Wraps a foreign error F (e.g. an OS I/O error) into E, optionally attaching a context message.

Provided Methods§

Source

fn timeout_error(&self) -> E

Returns the error value to use when the process exceeds its timeout.

Defaults to Self::error_type. Override to return a distinct timeout-specific error variant.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§