1 2 3 4 5 6 7 8 9
use std::cell::RefCell; tokio::task_local! { pub static REQUEST_ID: RefCell<Option<String>>; } pub fn get_request_id() -> Option<String> { REQUEST_ID.try_with(|id| id.borrow().clone()).ok().flatten() }