pub trait Component {
type Message;
type Properties;
// Required methods
fn create(properties: Self::Properties, context: ComponentContext) -> Self;
fn update(&mut self, message: Self::Message) -> bool;
fn view(&self) -> VirtualNode;
}Expand description
Trait defining the lifecycle of a component.
Components are the primary building blocks of euv applications. Each component has its own state, message type, and rendering logic.
Required Associated Types§
Sourcetype Properties
type Properties
The type of properties passed to this component.
Required Methods§
Sourcefn create(properties: Self::Properties, context: ComponentContext) -> Self
fn create(properties: Self::Properties, context: ComponentContext) -> Self
Creates a new component instance with the given properties and context.
Sourcefn update(&mut self, message: Self::Message) -> bool
fn update(&mut self, message: Self::Message) -> bool
Updates the component state in response to a message.
Sourcefn view(&self) -> VirtualNode
fn view(&self) -> VirtualNode
Renders the component to a virtual DOM node.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.