asupersync-macros 0.1.0

Proc macros for asupersync structured concurrency runtime
Documentation
asupersync-macros-0.1.0 has been yanked.

Proc macros for asupersync structured concurrency runtime.

This crate provides procedural macros that simplify working with the asupersync async runtime's structured concurrency primitives. The macros handle the boilerplate for creating scopes, spawning tasks, joining results, and racing computations.

Available Macros

  • [scope!] - Create a structured concurrency scope
  • [spawn!] - Spawn a task within the current scope
  • [join!] - Join multiple futures, waiting for all to complete
  • [race!] - Race multiple futures, returning the first to complete

Example

use asupersync_macros::{scope, spawn, join, race};

async fn example(cx: &mut Cx) {
    scope!(cx, {
        let handle1 = spawn!(async { compute_a().await });
        let handle2 = spawn!(async { compute_b().await });

        // Wait for both
        let (result_a, result_b) = join!(handle1, handle2);
    });
}