Trait tuirealm::Component[][src]

pub trait Component {
    fn render(&self, frame: &mut Canvas<'_>, area: Rect);
fn update(&mut self, props: Props) -> Msg;
fn get_props(&self) -> Props;
fn on(&mut self, ev: Event) -> Msg;
fn get_state(&self) -> Payload;
fn blur(&mut self);
fn active(&mut self); }

Component

Component is a trait which defines the behaviours for a View component.

Required methods

fn render(&self, frame: &mut Canvas<'_>, area: Rect)[src]

render

Based on the current properties and states, renders the component in the provided area frame

fn update(&mut self, props: Props) -> Msg[src]

update

Update component properties Properties should first be retrieved through get_props which returns the current properties, which can be used to create new properties. Returns a Msg to the view

fn get_props(&self) -> Props[src]

get_props

Returns the current component properties. The returned properties can then be used to create a new PropsBuilder, which can lately be used to update the component’s properties.

fn on(&mut self, ev: Event) -> Msg[src]

on

Handle input event and update internal states. Returns a Msg to the view

fn get_state(&self) -> Payload[src]

get_state

Get current state from component

fn blur(&mut self)[src]

blur

Blur component; basically remove focus

fn active(&mut self)[src]

active

Active component; basically give focus

Loading content...

Implementors

Loading content...