1use crate::perf_scope;
2use std::future::Future;
3
4pub fn dispatch_query<R>(label: &'static str, f: impl FnOnce() -> R) -> R {
6 perf_scope!("{label}");
7 f()
8}
9
10pub async fn dispatch_query_async<R, F>(label: &'static str, f: impl FnOnce() -> F) -> R
12where
13 F: Future<Output = R>,
14{
15 perf_scope!("{label}");
16 f().await
17}
18
19pub fn dispatch_update<R>(label: &'static str, f: impl FnOnce() -> R) -> R {
21 perf_scope!("{label}");
22 f()
23}
24
25pub async fn dispatch_update_async<R, F>(label: &'static str, f: impl FnOnce() -> F) -> R
27where
28 F: Future<Output = R>,
29{
30 perf_scope!("{label}");
31 f().await
32}