pub trait DynamicComponentContract: 'static {
type Props: Serialize + for<'de> Deserialize<'de> + Clone + PartialEq + 'static;
type Event: Serialize + for<'de> Deserialize<'de> + Clone + 'static;
const INTERFACE_ID: &'static str;
const INTERFACE_VERSION: u32;
const STATE_SCHEMA_VERSION: u32;
// Required methods
fn wit_definition() -> &'static str;
fn fallback_spec(props: &Self::Props) -> DynamicNodeSpec;
fn decode_action(
action: &DynamicActionEvent,
props: &Self::Props,
) -> Option<Self::Event>;
}Expand description
Compile-time strongly-typed dynamic component interface shared by Wasm Component (WIT) and Declarative Data channels.
Required Associated Constants§
Sourceconst INTERFACE_ID: &'static str
const INTERFACE_ID: &'static str
Canonical interface identifier verified against pinned release artifacts before activation.
Sourceconst INTERFACE_VERSION: u32
const INTERFACE_VERSION: u32
Interface contract version independent of implementation and state schema versions.
Sourceconst STATE_SCHEMA_VERSION: u32
const STATE_SCHEMA_VERSION: u32
Expected component local state schema version.
Required Associated Types§
Sourcetype Props: Serialize + for<'de> Deserialize<'de> + Clone + PartialEq + 'static
type Props: Serialize + for<'de> Deserialize<'de> + Clone + PartialEq + 'static
Strongly-typed input properties validated by the Rust compiler at every call site.
Sourcetype Event: Serialize + for<'de> Deserialize<'de> + Clone + 'static
type Event: Serialize + for<'de> Deserialize<'de> + Clone + 'static
Strongly-typed output events validated by the Rust compiler on every handler.
Required Methods§
Sourcefn wit_definition() -> &'static str
fn wit_definition() -> &'static str
Returns the WIT interface source defining this component contract.
§Returns
&'static str- Canonical WIT definition.
Sourcefn fallback_spec(props: &Self::Props) -> DynamicNodeSpec
fn fallback_spec(props: &Self::Props) -> DynamicNodeSpec
Sourcefn decode_action(
action: &DynamicActionEvent,
props: &Self::Props,
) -> Option<Self::Event>
fn decode_action( action: &DynamicActionEvent, props: &Self::Props, ) -> Option<Self::Event>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl DynamicComponentContract for ProductCardContract
Reference strongly-typed dynamic component contract implementation for ProductCardContract.
impl DynamicComponentContract for ProductCardContract
Reference strongly-typed dynamic component contract implementation for ProductCardContract.