pub trait Component<MSG, XMSG> {
    // Required methods
    fn init(&mut self) -> Vec<Task<MSG>>;
    fn update(&mut self, msg: MSG) -> Effects<MSG, XMSG>;
    fn view(&self) -> Node<MSG>;
    fn stylesheet() -> Vec<String>;

    // Provided method
    fn style(&self) -> Vec<String> { ... }
}
Expand description

A component has a view and can update itself.

The update function returns an effect which can contain follow ups and effects. Follow ups are executed on the next update loop of this component, while the effects are executed on the parent component that mounts it.

Required Methods§

source

fn init(&mut self) -> Vec<Task<MSG>>

init the component

source

fn update(&mut self, msg: MSG) -> Effects<MSG, XMSG>

Update the model of this component and return follow up and/or effects that will be executed on the next update loop

source

fn view(&self) -> Node<MSG>

the view of the component

source

fn stylesheet() -> Vec<String>

component can have static styles

Provided Methods§

source

fn style(&self) -> Vec<String>

in addition, component can contain dynamic style which can change when the model is updated

Implementors§

source§

impl<CONT, MSG> Component<MSG, ()> for CONTwhere CONT: Container<MSG, ()> + CustomElement<MSG>, MSG: 'static,

Auto implementation of Component trait for Container, which in turn creates an Auto implementation trait for of Application for Container but only if that Container is intended to be a CustomElement