Skip to main content

block_on

Function block_on 

pub fn block_on<F>(fut: F) -> <F as IntoFuture>::Output
where F: IntoFuture,
Expand description

Runs a future to completion on the test thread: async handlers, helpers and ocre::password in plain unit tests (no async runtime runs outside workerd). It is pollster::block_on.

§Examples

async fn up() -> &'static str {
    "OK"
}

assert_eq!(ocre::testing::block_on(up()), "OK");

Block the thread until the future is ready.

§Example

let my_fut = async {};
let result = pollster::block_on(my_fut);