euv-core 0.48.3

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

/// Compile-time strongly-typed dynamic component interface shared by Wasm Component (WIT) and Declarative Data channels.
pub trait DynamicComponentContract: 'static {
    /// Strongly-typed input properties validated by the Rust compiler at every call site.
    type Props: Serialize + for<'de> Deserialize<'de> + Clone + PartialEq + 'static;

    /// Strongly-typed output events validated by the Rust compiler on every handler.
    type Event: Serialize + for<'de> Deserialize<'de> + Clone + 'static;

    /// Canonical interface identifier verified against pinned release artifacts before activation.
    const INTERFACE_ID: &'static str;

    /// Interface contract version independent of implementation and state schema versions.
    const INTERFACE_VERSION: u32;

    /// Expected component local state schema version.
    const STATE_SCHEMA_VERSION: u32;

    /// Returns the WIT interface source defining this component contract.
    ///
    /// # Returns
    ///
    /// - `&'static str` - Canonical WIT definition.
    fn wit_definition() -> &'static str;

    /// Builds the compiled native fallback UI tree used before any remote release is active.
    ///
    /// # Arguments
    ///
    /// - `&Self::Props` - Strongly-typed component properties.
    ///
    /// # Returns
    ///
    /// - `DynamicNodeSpec` - Fallback declarative UI subtree.
    fn fallback_spec(props: &Self::Props) -> DynamicNodeSpec;

    /// Decodes a dynamic UI control action back into a strongly-typed `Self::Event`.
    ///
    /// # Arguments
    ///
    /// - `&DynamicActionEvent` - Raw interaction event from a dynamic slot control.
    /// - `&Self::Props` - Active typed properties of the slot.
    ///
    /// # Returns
    ///
    /// - `Option<Self::Event>` - Typed event when recognized by this contract.
    fn decode_action(action: &DynamicActionEvent, props: &Self::Props) -> Option<Self::Event>;
}