Function block_on_future

Source
pub fn block_on_future<T>(future: impl Future<Output = T>) -> T
Expand description

Runs a future to completion on the current task and returns its output value.

§Panics

If run from outside a Task.

veecle_freertos_integration::task::block_on_future(async { 2 + 2 });

§Examples

veecle_freertos_integration::Task::new().start(|_| {
    let result = veecle_freertos_integration::task::block_on_future(async { 2 + 2 });
    assert_eq!(result, 4);
});