Skip to main content

Component

Trait Component 

Source
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§

Source

type Message

The type of messages this component can receive.

Source

type Properties

The type of properties passed to this component.

Required Methods§

Source

fn create(properties: Self::Properties, context: ComponentContext) -> Self

Creates a new component instance with the given properties and context.

Source

fn update(&mut self, message: Self::Message) -> bool

Updates the component state in response to a message.

Source

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.

Implementors§