macro_rules! rumtk_async_sleep {
( $dur:expr) => { ... };
}
Expand description
Sleep for some duration of time in an async context. Meaning, we can be awaited.
You can pass any value that can be cast to f32.
The precision is up to nanoseconds and it is depicted by the number of decimal places.
ยงExamples
use rumtk_core::{rumtk_async_sleep, rumtk_exec_task};
use rumtk_core::core::RUMResult;
rumtk_exec_task!( async || -> RUMResult<()> {
rumtk_async_sleep!(1).await; // Sleeps for 1 second.
rumtk_async_sleep!(0.001).await; // Sleeps for 1 millisecond
rumtk_async_sleep!(0.000001).await; // Sleeps for 1 microsecond
rumtk_async_sleep!(0.000000001).await; // Sleeps for 1 nanosecond
Ok(())
}
);