pub fn block_on_task<R, F>(task: F) -> RUMResult<R>Expand description
Given a closure task, push it onto the current tokio runtime for execution.
Every [DEFAULT_SLEEP_DURATION] seconds, we check if the task has concluded.
Once the task has concluded, we call tokio::block_on to resolve and extract the task
result.
Because this helper function can fail, the return value is wrapped inside a RUMResult.
ยงExample
use rumtk_core::threading::threading_functions::{init_runtime, block_on_task};
const Hello: &str = "World!";
init_runtime(5);
let result = block_on_task(async {
Hello
}).unwrap();
assert_eq!(Hello, result, "Result mismatches expected! {} vs. {}", Hello, result);