incular-runtime 0.1.1

Application runtime and scheduling foundations for Incular
Documentation
//! Controlled BUILD → LAYOUT → PAINT coordination and local reactive state.

mod app_log;
mod application;
mod application_activations;
mod application_shell;
mod application_types;
mod context;
#[cfg(feature = "devtools")]
mod devtools_inspection;
mod environment;
mod executor;
pub use executor::sleep;
mod file_dialogs;
mod frame;
mod global_shortcuts;
mod profiling;
mod reactive;
mod request_admission;
mod request_channel;
mod request_registry;
mod restoration;
mod route_focus;
mod route_outlet;
mod route_tasks;
mod simulation;
mod tasks;
mod text_shortcuts;
mod transient_presentation;
mod undo;
mod window_commands;
mod window_state;

pub use app_log::{
    LOG_MESSAGE_LIMIT, LOG_QUEUE_CAPACITY, LogBatch, LogLevel, LogQueue, LogRecord, log,
};
#[cfg(feature = "devtools")]
pub use app_log::{drain_logs, logs_pending, set_log_wake};
pub use application::{Application, PERFORMANCE_OVERLAY_KEY};
pub use application_activations::{
    ActivationRouteBridge, ApplicationActivationListener, ApplicationActivationService,
    ApplicationActivationSubscription,
};
pub use application_shell::{
    ApplicationShellRequestId, ApplicationShellService, MemoryApplicationShellAdapter,
    NativeApplicationShellApplyResult, NativeApplicationShellCompletion,
    NativeApplicationShellEvent, NativeApplicationShellOperation, NativeApplicationShellRequest,
    NotificationHandle, TrayItemHandle,
};
pub use application_types::{
    ApplicationLifecycle, LastWindowPolicy, LifecycleTransition, RestorableWindowFactory,
    RuntimeErrorReport, WindowError, WindowRestorationId,
};
pub use context::BuildContext;
#[cfg(feature = "devtools")]
pub use environment::devtools_registry;
pub use environment::{EditableSignalKind, Signal, SignalRegistration};
pub use file_dialogs::{
    FileDialogCompletionStatus, FileDialogRequest, FileDialogService, MemoryFileDialogAdapter,
    NativeFileDialogCompletion, NativeFileDialogRequest,
};
pub use frame::{EditingDiagnostics, EventTarget, FocusDiagnostics, FrameStats, Runtime};
pub use global_shortcuts::{
    GlobalShortcutCompletionStatus, GlobalShortcutRegistration, GlobalShortcutRegistrationRequest,
    GlobalShortcutRequestId, GlobalShortcutService, GlobalShortcutUnregistrationRequest,
    MemoryGlobalShortcutAdapter, NativeGlobalShortcutCompletion, NativeGlobalShortcutOperation,
    NativeGlobalShortcutRequest,
};
pub use incular_accessibility::AccessibilityDiagnostics;
#[cfg(feature = "hot-reload")]
pub use incular_core::hot_reload::{HotPatch, HotPatchError, aslr_reference};
pub use profiling::{
    AccessibilitySnapshot, BudgetStatistics, FrameHistory, FrameRecord, FrameStatistics,
    FrameTimings, FrameWork, GpuResourceSummary, GpuSample, PerformanceHub, PerformanceProfiler,
    PerformanceSnapshot, ProfilerMode, RenderFrameMetrics, SchedulerCounters, TextCacheSnapshot,
    WidgetWorkSnapshot, WindowPerformance,
};
pub use reactive::{Action, ActionDispatchError, ActionError, ActionState, Effect, Memo};
#[cfg(target_arch = "wasm32")]
pub use restoration::BrowserRestorationStore;
pub use restoration::{
    ClaimedRestorationScope, DEFAULT_RESTORATION_DEBOUNCE, DEFAULT_RESTORATION_SNAPSHOT_LIMIT,
    FRAMEWORK_RESTORATION_FORMAT_VERSION, FileRestorationStore, InMemoryRestorationStore,
    MAX_RESTORATION_SAVE_RETRIES, RESTORATION_RETRY_BACKOFF, Restorable, RestorableBool,
    RestorableBoolN, RestorableDouble, RestorableDoubleN, RestorableInt, RestorableIntN,
    RestorableString, RestorableStringN, RestorationConfig, RestorationDiagnostics,
    RestorationHandle, RestorationMigration, RestorationStore, RestorationStoreError,
};
pub use route_focus::{RouteFocusOwner, RouteFocusState};
pub use route_outlet::{OutletAttachError, OutletError, OutletId, OutletPlacement, RouteOutlet};
pub use route_tasks::RouteTaskBinding;
pub use simulation::{Screenshot, Simulation, SimulationError};
#[cfg(not(target_arch = "wasm32"))]
pub use tasks::TokioHandle;
pub use tasks::{
    AsyncState, AsyncValue, RuntimeDiagnostics, RuntimeSpawner, RuntimeWake, Task, TaskFailure,
    TaskHandle, TaskScope, UiDispatcher,
};
pub use text_shortcuts::TextShortcutPlatform;
pub use transient_presentation::{
    ResolvedTransientPresentation, TransientFallbackReason, TransientPresentationResolution,
};
pub use undo::{UndoHistoryController, UndoHistoryState};
pub use window_commands::{
    NativeOperationCompletionStatus, NativeOperationRequest, NativeWindowCommand,
    WindowCommandEnqueueError, WindowHandle, WindowOpener, WindowPlacementError,
};
pub use window_state::{ApplicationDiagnostics, WindowDiagnostics};

// Compatibility imports for the existing implementation submodules. These
// remain private to the facade while preserving their original super:: paths.
pub(crate) use environment::{
    BUILD_SCOPE, BuildScope, Dependency, NEXT_REACTIVE_NODE, ReactiveNode, ReactiveNodeId,
    ReactiveQueue, ReactiveRootId, TrackedDependency,
};
pub(crate) use frame::diagnostic_input_trigger;

/// Process-wide scheduler/reactivity counters. Relaxed atomics on the UI
/// thread cost a single increment per event and never allocate.
mod scheduler_counters {
    use std::sync::atomic::{AtomicU64, Ordering};
    pub static SIGNAL_READS: AtomicU64 = AtomicU64::new(0);
    pub static SIGNAL_WRITES: AtomicU64 = AtomicU64::new(0);
    pub static DEPENDENTS_ENQUEUED: AtomicU64 = AtomicU64::new(0);
    pub static RUNTIME_WAKES: AtomicU64 = AtomicU64::new(0);
    pub static REDRAW_REQUESTS: AtomicU64 = AtomicU64::new(0);
    pub static FRAMES_STARTED: AtomicU64 = AtomicU64::new(0);
    pub static FRAMES_PRESENTED: AtomicU64 = AtomicU64::new(0);
    pub static FRAMES_SKIPPED: AtomicU64 = AtomicU64::new(0);
    #[must_use]
    pub fn load(counter: &AtomicU64) -> u64 {
        counter.load(Ordering::Relaxed)
    }
}

#[must_use]
pub fn scheduler_counters() -> SchedulerCounters {
    SchedulerCounters {
        signal_reads: scheduler_counters::load(&scheduler_counters::SIGNAL_READS),
        signal_writes: scheduler_counters::load(&scheduler_counters::SIGNAL_WRITES),
        dependents_enqueued: scheduler_counters::load(&scheduler_counters::DEPENDENTS_ENQUEUED),
        runtime_wakes: scheduler_counters::load(&scheduler_counters::RUNTIME_WAKES),
        redraw_requests: scheduler_counters::load(&scheduler_counters::REDRAW_REQUESTS),
        frames_started: scheduler_counters::load(&scheduler_counters::FRAMES_STARTED),
        frames_presented: scheduler_counters::load(&scheduler_counters::FRAMES_PRESENTED),
        frames_skipped: scheduler_counters::load(&scheduler_counters::FRAMES_SKIPPED),
    }
}