supercode-reduce 0.5.45

Optional lossless, reversible session reduction for Volter Harness
Documentation
//! Errors raised by reversible projection, verification, and rehydration.

use std::fmt;

/// A reduction invariant failed or a reversible pointer could not be resolved.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ReductionError {
    message: String,
}

impl ReductionError {
    /// Build an error with a stable, user-facing explanation.
    pub fn new(message: impl Into<String>) -> Self {
        Self {
            message: message.into(),
        }
    }

    /// Return the invariant failure explanation.
    pub fn message(&self) -> &str {
        &self.message
    }
}

impl fmt::Display for ReductionError {
    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
        formatter.write_str(&self.message)
    }
}

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

/// Result type for standalone reduction operations.
pub type Result<T> = std::result::Result<T, ReductionError>;