Skip to main content

InteractiveComponent

Trait InteractiveComponent 

Source
pub trait InteractiveComponent<A, Ctx = DefaultBindingContext>: ComponentDebugState {
    type Props<'a>
       where Self: 'a;

    // Required method
    fn render(
        &mut self,
        frame: &mut Frame<'_>,
        area: Rect,
        props: Self::Props<'_>,
    );

    // Provided methods
    fn subscriptions() -> &'static [EventType] { ... }
    fn update(
        &mut self,
        input: ComponentInput<'_, Ctx>,
        props: Self::Props<'_>,
    ) -> HandlerResponse<A> { ... }
}
Expand description

Richer component contract used by ComponentHost.

Required Associated Types§

Source

type Props<'a> where Self: 'a

Required Methods§

Source

fn render(&mut self, frame: &mut Frame<'_>, area: Rect, props: Self::Props<'_>)

Provided Methods§

Source

fn subscriptions() -> &'static [EventType]

Event types this component should receive when bound through ComponentHost.

Focused and hovered components still receive routed input through the normal EventBus routing path. Subscriptions are for events the component wants even when it is not the focused or hovered target.

Source

fn update( &mut self, input: ComponentInput<'_, Ctx>, props: Self::Props<'_>, ) -> HandlerResponse<A>

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§

Source§

impl<A, Ctx> InteractiveComponent<A, Ctx> for ScrollView

Source§

type Props<'a> = ScrollViewProps<'a, A>

Source§

impl<A, Ctx> InteractiveComponent<A, Ctx> for TextInput

Source§

type Props<'a> = TextInputProps<'a, A>

Source§

impl<Id, Node, A, Ctx> InteractiveComponent<A, Ctx> for TreeView<Id, Node>
where Id: Clone + Eq + Hash + 'static,

Source§

type Props<'a> = TreeViewProps<'a, Id, Node, A> where Node: 'a

Source§

impl<Item, A, Ctx> InteractiveComponent<A, Ctx> for SelectList<Item>

Source§

type Props<'a> = SelectListProps<'a, Item, A> where Item: 'a