Skip to main content

delayed_function

Function delayed_function 

Source
pub async fn delayed_function<F, Fut, T>(delay: Duration, func: F) -> T
where F: FnOnce() -> Fut, Fut: Future<Output = T>,
Expand description

Executes a closure after a specified delay, always asynchronously.

§Arguments

  • delay - Duration to wait before executing
  • func - Async closure or function to execute after the delay

§Returns

The result of the closure.