block_on

Function block_on 

Source
pub fn block_on<F, T>(async_op: F) -> Result<T>
where F: Future<Output = T> + Send, T: Send,
Expand description

Block on an async function with a generic return type

Similar to execute but supports any return type, not just Result<()>. Used for domain functions that return values.

§Examples

use ggen_utils::error::Result;

fn get_data() -> Result<String> {
    crate::runtime::block_on(async {
        Ok("data".to_string())
    })
}