#[repr(C)]pub struct ComponentDef {
pub id: ComponentId,
pub display_name: AzString,
pub description: AzString,
pub css: AzString,
pub source: ComponentSource,
pub data_model: ComponentDataModel,
pub render_fn: ComponentRenderFn,
pub compile_fn: ComponentCompileFn,
pub render_fn_source: OptionString,
pub compile_fn_source: OptionString,
}Expand description
A component definition — the “class” / “template” of a component. Can come from Rust builtins, compiled widgets, JSON, or user creation in debugger.
Fields§
§id: ComponentIdCollection + name, e.g. builtin:div, shadcn:avatar
display_name: AzStringHuman-readable display name, e.g. “Link” for builtin:a, “Avatar” for shadcn:avatar
description: AzStringMarkdown documentation for the component
css: AzStringThe component’s CSS
source: ComponentSourceWhere this component was defined (determines exportability)
data_model: ComponentDataModelUnified data model: all value fields, callback slots, and child slots
in a single named struct. Code gen uses data_model.name as the
input struct type name (e.g. “ButtonData”).
The default_value on each field doubles as the “current value” for
preview rendering — callers override defaults before calling render_fn.
render_fn: ComponentRenderFnRender to live DOM
compile_fn: ComponentCompileFnCompile to source code in target language
render_fn_source: OptionStringSource code for render_fn (user-defined components only)
compile_fn_source: OptionStringSource code for compile_fn (user-defined components only)
Trait Implementations§
Source§impl Clone for ComponentDef
impl Clone for ComponentDef
Source§fn clone(&self) -> ComponentDef
fn clone(&self) -> ComponentDef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ComponentDef
impl Debug for ComponentDef
Source§impl Extend<ComponentDef> for ComponentDefVec
impl Extend<ComponentDef> for ComponentDefVec
Source§fn extend<T: IntoIterator<Item = ComponentDef>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = ComponentDef>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)