Skip to main content

block_on

Function block_on 

pub fn block_on<F: Future>(future: F) -> F::Output
Expand description

Drives a future to completion on the current thread.

This exists so the testkit can demonstrate a harness that depends on no async runtime at all, which is what keeps the conformance suite from quietly acquiring a tokio requirement. It is deliberately not bounded on Send: the rules are written against EventStore, the !Send flavour, and a block_on that demanded Send would exclude exactly the adapters that flavour exists for.

§Panics

Not itself. A failing rule panics inside the polled future and that panic propagates, which is what makes the enclosing #[test] fail.

§Examples

assert_eq!(happenstance_testkit::block_on(async { 1 + 1 }), 2);