euv-core 0.57.0

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::*;

crate::euv_devtools_only_items! {
    /// Internal fixed-size zero-allocation breadcrumb slot stored inside the global runtime ring buffer.
    #[derive(Clone, Copy, Debug)]
    pub(crate) struct InlineBreadcrumbSlot {
        /// Monotonic event sequence number (`0` marks an empty slot).
        pub(crate) seq: u64,
        /// Frame index active when this event was recorded.
        pub(crate) frame_seq: u64,
        /// Valid UTF-8 byte length inside `kind_buf`.
        pub(crate) kind_len: u8,
        /// Fixed inline UTF-8 storage for the event kind label.
        pub(crate) kind_buf: [u8; PANIC_MAX_KIND_BYTES],
        /// Valid UTF-8 byte length inside `detail_buf`.
        pub(crate) detail_len: u8,
        /// Fixed inline UTF-8 storage for the event detail summary.
        pub(crate) detail_buf: [u8; PANIC_MAX_DETAIL_BYTES],
    }

    /// Internal zero-allocation runtime context state updated on hot UI/router/frame paths.
    #[derive(Debug)]
    pub(crate) struct InlineRuntimeContextState {
        /// Valid UTF-8 byte length inside `route_buf`.
        pub(crate) route_len: usize,
        /// Fixed inline UTF-8 storage for the active route path.
        pub(crate) route_buf: [u8; PANIC_MAX_ROUTE_BYTES],
        /// Valid UTF-8 byte length inside `theme_buf`.
        pub(crate) theme_len: usize,
        /// Fixed inline UTF-8 storage for the active theme descriptor.
        pub(crate) theme_buf: [u8; PANIC_MAX_THEME_BYTES],
        /// Valid UTF-8 byte length inside `overlays_buf` (comma-separated overlay names).
        pub(crate) overlays_len: usize,
        /// Fixed inline UTF-8 storage for active overlay identifiers.
        pub(crate) overlays_buf: [u8; PANIC_MAX_OVERLAYS_BYTES],
        /// Current logical viewport width in points.
        pub(crate) viewport_width: f32,
        /// Current logical viewport height in points.
        pub(crate) viewport_height: f32,
        /// Current physical display scale factor.
        pub(crate) scale_factor: f32,
        /// Latest rendered frame sequence number.
        pub(crate) frame_seq: u64,
        /// Whether the runtime is currently settled in idle state.
        pub(crate) is_idle: bool,
        /// Next monotonic sequence number for breadcrumb writes.
        pub(crate) next_seq: u64,
        /// Circular write cursor inside `breadcrumbs`.
        pub(crate) write_cursor: usize,
        /// Number of valid entries currently stored in `breadcrumbs`.
        pub(crate) count: usize,
        /// Fixed-capacity ring buffer of recent runtime events.
        pub(crate) breadcrumbs: [InlineBreadcrumbSlot; PANIC_BREADCRUMB_RING_CAPACITY],
    }
}

/// Owned chronological runtime event breadcrumb exported in panic forensics and event traces.
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct RuntimeEventBreadcrumb {
    /// Monotonic breadcrumb sequence number.
    #[get(type(copy))]
    pub(crate) seq: u64,
    /// Normalized event category (e.g. `"ui_event"`, `"route"`, `"overlay"`, `"idle"`).
    pub(crate) kind: String,
    /// Concise event payload summary.
    pub(crate) detail: String,
    /// Frame sequence index active when this breadcrumb was recorded.
    #[get(type(copy))]
    pub(crate) frame_seq: u64,
}

/// Live runtime scene, viewport, theme, overlay, and recent event context captured alongside a panic.
#[derive(Clone, Data, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct PanicRuntimeContext {
    /// Active application route string.
    pub(crate) active_route: String,
    /// Logical viewport width in pixels.
    #[get(type(copy))]
    pub(crate) viewport_width: f32,
    /// Logical viewport height in pixels.
    #[get(type(copy))]
    pub(crate) viewport_height: f32,
    /// Physical display scale factor.
    #[get(type(copy))]
    pub(crate) scale_factor: f32,
    /// Active theme descriptor (scheme and Light/Dark mode).
    pub(crate) theme: String,
    /// Active top-layer overlay identifiers.
    pub(crate) active_overlays: Vec<String>,
    /// Latest rendered frame index.
    #[get(type(copy))]
    pub(crate) frame_seq: u64,
    /// Whether the runtime was settled in idle mode at capture time.
    #[get(type(copy))]
    pub(crate) is_idle: bool,
    /// Bounded chronological ring of recent runtime events leading up to capture.
    pub(crate) recent_breadcrumbs: Vec<RuntimeEventBreadcrumb>,
}

/// Complete structured panic forensics record preserving forced backtrace, error payload, source site, and runtime context.
#[derive(Clone, Data, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct PanicForensicsRecord {
    /// UTC timestamp in RFC3339 format when the panic occurred.
    pub(crate) timestamp_utc: String,
    /// Exact panic error payload message.
    pub(crate) message: String,
    /// Source file path reported by `PanicHookInfo::location`.
    pub(crate) location_file: String,
    /// One-based source line number (`0` when unavailable).
    #[get(type(copy))]
    pub(crate) location_line: u32,
    /// One-based source column number (`0` when unavailable).
    #[get(type(copy))]
    pub(crate) location_col: u32,
    /// Thread name where the panic originated.
    pub(crate) thread_name: String,
    /// Parsed non-empty stack frames extracted from the forced backtrace.
    pub(crate) backtrace_frames: Vec<String>,
    /// Full verbatim forced backtrace string.
    pub(crate) raw_backtrace: String,
    /// Snapshot of live runtime route, viewport, theme, overlays, and event breadcrumbs.
    pub(crate) runtime_context: PanicRuntimeContext,
}