yyu-nim / yyu-nim.github.io

Production-ready Rust Libraries (PRL)
5 stars 0 forks source link

https://yyu-nim.github.io/rust/lazy_static/async_once/2022/09/25/lazy-static-async-init.html #13

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

lazy_static <3> - lazy eval. with async/await | Production-ready Rust Libraries (PRL)

lazy_static!{} 내부에 싱글턴 생성 로직을 넣다보면 궁금할 때가 있을 것이다; async/await을 쓰고 싶으면 어떻게 하지? tokio 기반의 application에 싱글턴을 도입하려 한다면 꼭 한번 묻게되는 질문일 것이다. 단순하게, 새로운 async runtime을 생성해서 (e.g., tokio::runtime::Runtime::new()), block_o

https://yyu-nim.github.io/rust/lazy_static/async_once/2022/09/25/lazy-static-async-init.html

huijeong-kim commented 1 year ago

오!! 역시 다 방법이 있군요. 유용하게 쓸 것 같습니다 😀👍