crackle-runtime 0.2.0

Detect emergent patterns — clustering, correlations, phase transitions, and conservation laws — across task outputs
Documentation
use std::fmt;
#[cfg(feature = "serde")]
use serde::{Serialize, Deserialize};

/// Errors that can occur during crackle runtime operations.
#[derive(Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum CrackleError {
    /// A task panicked during firing.
    TaskPanicked(String),
    /// The kiln was already cooled and cannot accept new tasks.
    KilnCooled,
    /// Invalid thermal profile configuration.
    InvalidProfile(String),
    /// Pattern detection failed.
    DetectionFailed(String),
}

impl fmt::Display for CrackleError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            CrackleError::TaskPanicked(msg) => write!(f, "task panicked: {msg}"),
            CrackleError::KilnCooled => write!(f, "kiln has already cooled and cannot accept new tasks"),
            CrackleError::InvalidProfile(msg) => write!(f, "invalid thermal profile: {msg}"),
            CrackleError::DetectionFailed(msg) => write!(f, "pattern detection failed: {msg}"),
        }
    }
}

impl std::error::Error for CrackleError {}

/// A specialized result type for crackle runtime operations.
pub type Result<T> = std::result::Result<T, CrackleError>;