pub fn load<T, P, M>(
state: impl LoadSource<T, M>,
ready: impl Fn(Loaded<T>) -> P + 'static,
) -> LoadPiece<T>Expand description
The three states of an async load as three subtrees (docs/async.md): the ready arm, and
optional loading and failed arms (nothing is
built for a state without an arm). Arms rebuild only when the variant changes; a new
ready value updates the ready arm in place through Loaded::get.
ⓘ
load(stations, |s| station_list(s))
.loading(spinner)
.failed(|e| label(e.to_string()).secondary())Whether a refetch passes through Loading is the Resource’s
policy; an app that wants its stale content shown during a refresh keeps the last value in
its own state and the ready arm reads it.