Function get_current_runtime

Source
pub async fn get_current_runtime<'a>() -> &'a mut QueuedRuntime 
Expand description

This gets the currently running runtime. PANICS IF IT IS CALLED FROM OUTSIDE THE RUNTIME.

Examples found in repository?
examples/recursion.rs (line 13)
10async fn print_something_after_ms(ms: u64) {
11    wait_ms(ms).await;
12    println!("something after {ms}ms! :D");
13    get_current_runtime()
14        .await
15        .push(print_something_after_ms(ms + 1));
16}
More examples
Hide additional examples
examples/tcp.rs (line 22)
19async fn go(addr: (&str, u16)) {
20    let mut listener = TcpListener::bind(addr).unwrap();
21    loop {
22        get_current_runtime()
23            .await
24            .push(handle(accept(&mut listener).await.unwrap()));
25    }
26}