Skip to main content

Statusable

Trait Statusable 

Source
pub trait Statusable {
    // Required method
    fn status(&self) -> Status;

    // Provided method
    fn status_detail(&self) -> Option<StatusDetail> { ... }
}
Expand description

Status reporting for monitoring.

Managers need to know the status of their children. This enables:

  • UI display: Show progress to user
  • Health monitoring: Detect stuck/failed children
  • Orchestration: Coordinate parallel work

§Status Lifecycle

Initializing → Idle ⇄ Running → Completed
                 ↓         ↓
               Paused    Error
                 ↓         ↓
              Aborted ← ───┘

§Example

use orcs_component::{Statusable, Status, StatusDetail, Progress};

struct Compiler {
    status: Status,
    files_compiled: u64,
    total_files: u64,
}

impl Statusable for Compiler {
    fn status(&self) -> Status {
        self.status
    }

    fn status_detail(&self) -> Option<StatusDetail> {
        Some(StatusDetail {
            message: Some("Compiling...".into()),
            progress: Some(Progress::new(self.files_compiled, Some(self.total_files))),
            metadata: Default::default(),
        })
    }
}

Required Methods§

Source

fn status(&self) -> Status

Returns the current status.

This should reflect the actual state of the entity.

Provided Methods§

Source

fn status_detail(&self) -> Option<StatusDetail>

Returns detailed status information.

Optional - returns None by default. Implement for UI display or debugging.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Statusable for LuaChild

Source§

fn status(&self) -> Status

Implementors§