diff options
author | HampusM <hampus@hampusmat.com> | 2023-08-04 15:24:32 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-08-04 15:25:58 +0200 |
commit | 14e45fe9aa2431120cfd6a7240f8bb94e45e730d (patch) | |
tree | 72bceb0580801ec1d59fc7f79e609f0ac7c53681 /src/lib.rs | |
parent | dce6bfc2321c0041fef5a2cb368ff45ba089198b (diff) |
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
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 53 |
1 files changed, 0 insertions, 53 deletions
@@ -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)* }) - }) - }; -} |