Trait Component

Source
pub trait Component:
    Any
    + Send
    + Sync
    + Unpin {
    type Props<'a>: Props
       where Self: 'a;

    // Required method
    fn new(props: &Self::Props<'_>) -> Self;

    // Provided methods
    fn update(
        &mut self,
        _props: &mut Self::Props<'_>,
        _hooks: Hooks<'_, '_>,
        _updater: &mut ComponentUpdater<'_, '_>,
    ) { ... }
    fn draw(&mut self, drawer: &mut ComponentDrawer<'_, '_>) { ... }
    fn calc_children_areas(
        &self,
        children: &Components,
        layout_style: &LayoutStyle,
        drawer: &mut ComponentDrawer<'_, '_>,
    ) -> Vec<Rect> { ... }
    fn poll_change(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<()> { ... }
    fn render_ref(&self, _area: Rect, _buf: &mut Buffer) { ... }
}

Required Associated Types§

Source

type Props<'a>: Props where Self: 'a

Required Methods§

Source

fn new(props: &Self::Props<'_>) -> Self

Provided Methods§

Source

fn update( &mut self, _props: &mut Self::Props<'_>, _hooks: Hooks<'_, '_>, _updater: &mut ComponentUpdater<'_, '_>, )

Source

fn draw(&mut self, drawer: &mut ComponentDrawer<'_, '_>)

Source

fn calc_children_areas( &self, children: &Components, layout_style: &LayoutStyle, drawer: &mut ComponentDrawer<'_, '_>, ) -> Vec<Rect>

Source

fn poll_change(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<()>

Source

fn render_ref(&self, _area: Rect, _buf: &mut Buffer)

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§