Skip to main content

ComponentApi

Trait ComponentApi 

Source
pub trait ComponentApi:
    Send
    + Sync
    + 'static {
    // Required method
    fn name(&self) -> &'static str;

    // Provided method
    fn validate_properties(
        &self,
        _properties: &Map<String, Value>,
    ) -> Result<(), Vec<String>> { ... }
}
Expand description

The framework-agnostic definition of a component: its name and schema.

Required Methods§

Source

fn name(&self) -> &'static str

The component name as it appears in A2UI JSON (e.g. “Button”, “Text”).

Provided Methods§

Source

fn validate_properties( &self, _properties: &Map<String, Value>, ) -> Result<(), Vec<String>>

Validate component properties against catalog constraints.

Returns Ok(()) if valid, or a Vec<String> of validation error messages.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§