async_init 0.1.0

init object asynchronously without Arc<Mutex>
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
# async_init
init object asynchronously without Arc<Mutex>


```rust
#[async_init]
pub async fn get_db_pool() -> Result<MySqlPool, sqlx::Error> {
    println!("thread id is {:?}, create mysql pool", thread::current().id());
    let db_url = env::var("DATABASE_URL").expect("`DATABASE_URL` must be set to run this app");
    let pool:MySqlPool = Pool::new(&db_url).await?;
    Ok(pool)
}
```