Function with_loading_screen_async

Source
pub async fn with_loading_screen_async<F>(loading_fn: Option<fn()>, task_fn: F)
where F: FnOnce() + Send + 'static,
Expand description

Runs a loading screen animation while executing a task synchronously.

§Parameters

  • loading_fn: An optional function to display the loading screen. If None, the default donut spinner is used.
  • task_fn: The task to be executed synchronously.

§Examples

use loading_screen::{with_loading_screen, donut};

with_loading_screen(Some(donut), || {
    // Your task here
});