pub trait Component<Message, Renderer> {
type State: Default;
type Event;
fn update(
&mut self,
state: &mut Self::State,
event: Self::Event
) -> Option<Message>;
fn view(&self, state: &Self::State) -> Element<'_, Self::Event, Renderer>;
}
Expand description
A reusable, custom widget that uses The Elm Architecture.
A Component
allows you to implement custom widgets as if they were
iced
applications with encapsulated state.
In other words, a Component
allows you to turn iced
applications into
custom widgets and embed them without cumbersome wiring.
A Component
produces widgets that may fire an Event
and update the internal state of the Component
.
Additionally, a Component
is capable of producing a Message
to notify
the parent application of any relevant interactions.