Skip to main content

HasLoadingHint

Trait HasLoadingHint 

Source
pub trait HasLoadingHint: Clone + 'static {
    // Required method
    fn empty() -> Self;
}
Expand description

Optional payload for the Loading state.

Most users will leave this at the default () — the variant then carries no information beyond “we’re fetching”. Implement this trait for your loading-hint type to attach stale-while- revalidate metadata (last-known data, fetched-at timestamp, …) to the Loading arm.

The trait has a single associated constant — a zero-sized marker so the type can be used as a default type parameter — and one method that produces the “no prior data, no hint” sentinel.

Required Methods§

Source

fn empty() -> Self

The sentinel value representing “no prior data is available”. use_async slots this in for the first render so that .loading_hint() always returns a usable value, even before the future has a chance to produce one.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl HasLoadingHint for ()

Implements impl HasLoadingHint for ().

Source§

fn empty() -> Self

Constructs an empty AsyncData value (no data, no error).

Implementors§