pub async fn with_state_async<S, T, F, Fut>(state: Arc<S>, future: F) -> Twhere S: Send + Sync + 'static, F: FnOnce() -> Fut, Fut: Future<Output = T>,
异步版本的 State 守卫便利函数
state
future
返回异步操作的结果
use mf_rules_expression::functions::with_state_async; let state = Arc::new(State::default()); let result = with_state_async(state, async { // aync block }).await;