Hibana — Affine Multiparty Session Types for Rust


// 1. Global Choreography
const PING_PONG: g::Program_> = g::seq(
    g::send::Client, Server, Ping>(),
    g::send::Server, Client, Pong>(),
);

// 2. Compile-Time Projection
const CLIENT: g::RoleProgram0, _> = g::project(&PING_PONG);

// 3. Affine Execution
// Compiler enforces protocol compliance.
let (client, _) = client.flow::Ping>()?.send(&42u32).await?;
let (client, pong) = client.recv::Pong>().await?;



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *