From 14e45fe9aa2431120cfd6a7240f8bb94e45e730d Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 4 Aug 2023 15:24:32 +0200 Subject: refactor!: remove async_closure macro from API BREAKING CHANGE: The async_closure macro has been removed. This is because it is completely out of scope for this crate --- src/lib.rs | 53 ----------------------------------------------------- 1 file changed, 53 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 82a5a9e..4807f61 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -160,56 +160,3 @@ macro_rules! di_container_bind { syrette::declare_interface!($implementation -> $interface); }; } - -/// Creates a async closure. -/// -/// # Examples -/// ``` -/// # use syrette::async_closure; -/// # -/// # async fn do_heavy_operation(timeout: u32, size: u32) -> String { String::new() } -/// # -/// # async fn do_other_heavy_operation(input: String) -> String { String::new() } -/// # -/// async_closure!(|timeout, size| { -/// let value = do_heavy_operation(timeout, size).await; -/// -/// let final_value = do_other_heavy_operation(value).await; -/// -/// final_value -/// }); -/// ``` -/// -/// expands to the following -/// -/// ```rust -/// # async fn do_heavy_operation(timeout: u32, size: u32) -> String { String::new() } -/// # -/// # async fn do_other_heavy_operation(input: String) -> String { String::new() } -/// # -/// Box::new(|timeout, size| { -/// Box::pin(async move { -/// let value = do_heavy_operation(timeout, size).await; -/// -/// let final_value = do_other_heavy_operation(value).await; -/// -/// final_value -/// }) -/// }); -/// ``` -#[cfg(feature = "async")] -#[cfg_attr(doc_cfg, doc(cfg(feature = "async")))] -#[cfg(not(tarpaulin_include))] -#[macro_export] -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)* }) - }) - }; -} -- cgit v1.2.3-18-g5258