[][src]Trait yew::html::Component

pub trait Component: Sized + 'static {
    type Message: 'static;
    type Properties: Properties;
    fn create(props: Self::Properties, link: ComponentLink<Self>) -> Self;
fn update(&mut self, msg: Self::Message) -> ShouldRender; fn mounted(&mut self) -> ShouldRender { ... }
fn change(&mut self, _: Self::Properties) -> ShouldRender { ... }
fn destroy(&mut self) { ... } }

An interface of a UI-component. Uses self as a model.

Associated Types

type Message: 'static

Control message type which update loop get.

type Properties: Properties

Properties type of component implementation.

Loading content...

Required methods

fn create(props: Self::Properties, link: ComponentLink<Self>) -> Self

Initialization routine which could use a context.

fn update(&mut self, msg: Self::Message) -> ShouldRender

Called everytime when a messages of Msg type received. It also takes a reference to a context.

Loading content...

Provided methods

fn mounted(&mut self) -> ShouldRender

Called after the component has been attached to the VDOM and it is safe to receive messages from agents but before the browser updates the screen. If true is returned, the view will be re-rendered and the user will not see the initial render.

fn change(&mut self, _: Self::Properties) -> ShouldRender

Called when the component's parent component re-renders and the component's place in the DOM tree remains unchanged. If the component's place in the DOM tree changes, calling this method is unnecessary as the component is recreated from scratch. It defaults to true if not implemented.

fn destroy(&mut self)

Called for finalization on the final point of the component's lifetime.

Loading content...

Implementors

impl<T> Component for Select<T> where
    T: PartialEq + Clone + 'static, 
[src]

type Message = Msg

type Properties = Props<T>

Loading content...