pub trait Component {
// Required methods
fn build(&self, context: AppContext) -> impl Widget + 'static;
fn widget_id(&self) -> WidgetId;
// Provided method
fn compose(self) -> Composed<Self>
where Self: Sized { ... }
}Expand description
A trait for creating a Widget from simple functions.
Simplifies the creation of your own widgets.
Required Methods§
Sourcefn build(&self, context: AppContext) -> impl Widget + 'static
fn build(&self, context: AppContext) -> impl Widget + 'static
Builds the inner widget.
Provided Methods§
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.