diff options
Diffstat (limited to 'mingling_macros/src/lib.rs')
| -rw-r--r-- | mingling_macros/src/lib.rs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/mingling_macros/src/lib.rs b/mingling_macros/src/lib.rs index 21273ba..1b0cbb5 100644 --- a/mingling_macros/src/lib.rs +++ b/mingling_macros/src/lib.rs @@ -858,8 +858,6 @@ pub fn r_println(input: TokenStream) -> TokenStream { /// - The first parameter (previous type) must be taken **by move**, not by reference. /// - Resource injection parameters **must** be references (`&T` or `&mut T`), /// owned values are not allowed. -/// - When the `async` feature is enabled, `&mut T` cannot be used in async -/// chain functions (only `&T` is supported for async). /// /// # Sync Example /// @@ -924,6 +922,22 @@ pub fn r_println(input: TokenStream) -> TokenStream { /// } /// ``` /// +/// # Async Example with Mutable Resource Injection +/// +/// ```rust,ignore +/// use mingling::macros::{chain, pack, gen_program}; +/// +/// pack!(MyOutput = String); +/// +/// #[chain] +/// async fn greet(prev: HelloEntry, ec: &mut ResExitCode) -> Next { +/// let name = prev.first().cloned().unwrap_or_else(|| "World".to_string()); +/// ec.exit_code = 42; +/// some_async_fn(&name).await; +/// MyOutput::new(name) +/// } +/// ``` +/// /// # Requirements /// /// - The function must have at least **one** parameter (the previous type in the chain). |
