euv-core 0.52.1

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
use super::*;

/// Structured diagnostic snapshot of one panic intercepted by an `ErrorBoundary`.
#[derive(Clone, Data, Debug, Default, Eq, New, PartialEq)]
pub struct FaultRecord {
    /// Monotonic boundary-local fault sequence number.
    #[get(type(copy))]
    pub(crate) sequence: u64,
    /// Execution category where the panic occurred.
    #[get(type(copy))]
    pub(crate) origin: FaultOrigin,
    /// Human-readable scope or widget identifier.
    pub(crate) scope: String,
    /// Extracted panic payload message.
    pub(crate) message: String,
    /// Caller-supplied monotonic timestamp in milliseconds.
    #[get(type(copy))]
    pub(crate) timestamp_ms: u64,
}

/// Aggregated fault-isolation telemetry snapshot exported by an `ErrorBoundary`.
#[derive(Clone, Copy, Data, Debug, Default, Eq, New, PartialEq)]
pub struct ErrorBoundaryTelemetry {
    /// Current health state (`Healthy`, `Degraded`, or `Tripped`).
    #[get(type(copy))]
    pub(crate) state: ErrorBoundaryState,
    /// Cumulative number of caught panics across the boundary lifetime.
    #[get(type(copy))]
    pub(crate) total_faults: u64,
    /// Number of consecutive panics since the last success or recovery.
    #[get(type(copy))]
    pub(crate) consecutive_faults: u32,
    /// Number of explicit recoveries from `Degraded` or `Tripped` back to `Healthy`.
    #[get(type(copy))]
    pub(crate) recoveries: u64,
    /// Cumulative number of guarded invocations that completed without panicking.
    #[get(type(copy))]
    pub(crate) successful_invocations: u64,
    /// Number of recent fault records currently retained in history.
    #[get(type(copy))]
    pub(crate) history_len: usize,
}

/// Panic-isolating fault boundary protecting callbacks, reactive effects, and render hooks.
#[derive(Clone, Data, Debug)]
pub struct ErrorBoundary {
    /// Logical boundary identifier for diagnostics and telemetry attribution.
    pub(crate) name: String,
    /// Current boundary health and circuit-breaker state.
    #[get(type(copy))]
    pub(crate) state: ErrorBoundaryState,
    /// Maximum consecutive panics tolerated before transitioning to `Tripped`.
    #[get(type(copy))]
    pub(crate) max_consecutive_faults: u32,
    /// Maximum recent fault records kept in the ring history.
    #[get(type(copy))]
    pub(crate) history_limit: usize,
    /// Total panics intercepted over the lifetime of this boundary.
    #[get(type(copy))]
    pub(crate) total_faults: u64,
    /// Consecutive panics since the last successful call or recovery.
    #[get(type(copy))]
    pub(crate) consecutive_faults: u32,
    /// Number of explicit recoveries performed.
    #[get(type(copy))]
    pub(crate) recoveries: u64,
    /// Total guarded invocations that completed normally.
    #[get(type(copy))]
    pub(crate) successful_invocations: u64,
    /// Next monotonic sequence number assigned to intercepted faults.
    #[get(pub(crate), type(copy))]
    #[get_mut(skip)]
    #[set(pub(crate))]
    pub(crate) next_sequence: u64,
    /// Bounded FIFO history of recent intercepted faults.
    #[get(pub(crate))]
    #[get_mut(pub(crate))]
    #[set(skip)]
    pub(crate) history: VecDeque<FaultRecord>,
}