tokio-async-std 1.5.3

An async-std that can fit into tokio ecosystem straight ahead
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Creates a task-local value.

use std::cell::Cell;

use async_std::prelude::*;
use async_std::task;

task_local! {
    static VAR: Cell<i32>;
}

fn main() {
    task::block_on(VAR.scope(Cell::new(1), async {
        println!("var = {}", VAR.with(|v| v.get()));
        VAR.with(|v| v.set(2));
        println!("var = {}", VAR.with(|v| v.get()));
    }))
}