Component

Trait Component 

Source
pub trait Component: Sized {
    type Init<'a>;
    type Message;
    type Event;

    // Required methods
    fn init(init: Self::Init<'_>, sender: &ComponentSender<Self>) -> Self;
    async fn start(&mut self, sender: &ComponentSender<Self>) -> !;
    async fn update(
        &mut self,
        message: Self::Message,
        sender: &ComponentSender<Self>,
    ) -> bool;
    fn render(&mut self, sender: &ComponentSender<Self>);
}
Available on crate feature winio only.
Expand description

Foundamental GUI component.

Required Associated Types§

Source

type Init<'a>

Initial parameter type.

Source

type Message

The input message type to update.

Source

type Event

The output event type to the parent.

Required Methods§

Source

fn init(init: Self::Init<'_>, sender: &ComponentSender<Self>) -> Self

Create the initial component.

Source

async fn start(&mut self, sender: &ComponentSender<Self>) -> !

Start the event listening.

Source

async fn update( &mut self, message: Self::Message, sender: &ComponentSender<Self>, ) -> bool

Respond to the message.

Source

fn render(&mut self, sender: &ComponentSender<Self>)

Render the widgets.

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 Component for Button

Source§

impl Component for Canvas

Source§

impl Component for CheckBox

Source§

impl Component for ComboBox

Source§

impl Component for ComboEntry

Source§

impl Component for Edit

Source§

impl Component for Label

Source§

impl Component for ListBox

Source§

impl Component for Progress

Source§

impl Component for RadioButton

Source§

impl Component for TextBox

Source§

impl Component for Window

Source§

type Event = WindowEvent

Source§

type Init<'a> = MaybeBorrowedWindow<'a>

Source§

type Message = ()

Source§

impl<T> Component for ObservableVec<T>
where T: Clone,

Source§

impl<T> Component for ToolTip<T>
where T: Component + AsWidget,

Source§

type Event = <T as Component>::Event

Source§

type Init<'a> = <T as Component>::Init<'a>

Source§

type Message = <T as Component>::Message