pub trait StatefulWidget: 'static {
type State: State<Widget = Self>;
// Required method
fn create_state(&self) -> Self::State;
// Provided method
fn into_widget(self) -> Component
where Self: Sized { ... }
}Expand description
A widget whose State outlives the rebuilds. The widget is only the configuration:
it is made again on every rebuild, and the state is what is kept.
Required Associated Types§
Required Methods§
Sourcefn create_state(&self) -> Self::State
fn create_state(&self) -> Self::State
Makes the state, once, when the widget first enters the tree.
Provided Methods§
Sourcefn into_widget(self) -> Componentwhere
Self: Sized,
fn into_widget(self) -> Componentwhere
Self: Sized,
This component as a widget.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".