Widget Fetcher
The WidgetFetcher
widget can be used to asynchronously run data in the background and build a widget based on the result. This allows you to build widgets based on the state of the data (loaded or not).
WidgetFetcher::new(some_data(), Update::DRAW, |data: Option<MyData>| {
Text::new(if let Some(data) = data {
Text::new(data.to_string())
} else {
Text::new("Loading...".to_string())
})
})
See the fetcher example for full usage.