Skip to main content

euv_ui/hook/lazy/
enum.rs

1/// The state of a `LazyComponent`.
2///
3/// - `Pending` — the factory has not been called yet.
4/// - `Loading` — `prefetch()` has been called (or the
5///   factory is running synchronously); UI should show a
6///   spinner.
7/// - `Loaded(T)` — the factory has produced a value;
8///   `T::clone()` returns it.
9/// - `Failed(String)` — the factory panicked or returned
10///   an error message; UI should show an error state.
11#[derive(Clone, Debug, Default)]
12pub enum LoadState<T> {
13    /// The factory has not been called yet.
14    #[default]
15    Pending,
16    /// The factory is running (set by `prefetch()`).
17    Loading,
18    /// The factory has produced a value.
19    Loaded(T),
20    /// The factory failed; the message is for debugging.
21    Failed(String),
22}