aboutsummaryrefslogtreecommitdiff
path: root/src/test_utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test_utils.rs')
-rw-r--r--src/test_utils.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test_utils.rs b/src/test_utils.rs
index 6fba778..8f07fa9 100644
--- a/src/test_utils.rs
+++ b/src/test_utils.rs
@@ -536,3 +536,20 @@ pub mod mocks
impl crate::dependency_history::private::Sealed for DependencyHistory {}
}
}
+
+#[cfg(feature = "async")]
+macro_rules! async_closure {
+ (|$($args: ident),*| { $($inner: stmt);* }) => {
+ Box::new(|$($args),*| {
+ Box::pin(async move { $($inner)* })
+ })
+ };
+ (|| { $($inner: stmt);* }) => {
+ Box::new(|| {
+ Box::pin(async move { $($inner)* })
+ })
+ };
+}
+
+#[cfg(feature = "async")]
+pub(crate) use async_closure;