{"id":21092725,"url":"https://github.com/zakcutner/rumpsteak","last_synced_at":"2025-04-13T13:20:36.327Z","repository":{"id":53924895,"uuid":"339147074","full_name":"zakcutner/rumpsteak","owner":"zakcutner","description":":meat_on_bone: Session types for asynchronous communication between multiple parties.","archived":false,"fork":false,"pushed_at":"2024-07-09T10:44:18.000Z","size":487,"stargazers_count":41,"open_issues_count":1,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-27T04:22:23.756Z","etag":null,"topics":["async","deadlock","rust","safety","session","types"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zakcutner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-15T17:02:08.000Z","updated_at":"2025-03-09T03:06:35.000Z","dependencies_parsed_at":"2024-01-19T12:50:00.508Z","dependency_job_id":"cdbffa2f-2c5f-44c2-b714-6a9c6b90dc14","html_url":"https://github.com/zakcutner/rumpsteak","commit_stats":{"total_commits":107,"total_committers":3,"mean_commits":"35.666666666666664","dds":0.3457943925233645,"last_synced_commit":"2b93dbbe1955d6a8d7d1236aa7e2ac6f22fd36f1"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zakcutner%2Frumpsteak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zakcutner%2Frumpsteak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zakcutner%2Frumpsteak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zakcutner%2Frumpsteak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zakcutner","download_url":"https://codeload.github.com/zakcutner/rumpsteak/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248718016,"owners_count":21150488,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","deadlock","rust","safety","session","types"],"created_at":"2024-11-19T21:58:28.398Z","updated_at":"2025-04-13T13:20:36.302Z","avatar_url":"https://github.com/zakcutner.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :meat_on_bone: Rumpsteak\n\n[![Actions](https://github.com/zakcutner/rumpsteak/workflows/Check/badge.svg)](https://github.com/zakcutner/rumpsteak/actions)\n[![Crate](https://img.shields.io/crates/v/rumpsteak)](https://crates.io/crates/rumpsteak)\n[![Docs](https://docs.rs/rumpsteak/badge.svg)](https://docs.rs/rumpsteak)\n[![License](https://img.shields.io/crates/l/rumpsteak)](LICENSE)\n\n\u003e :warning: Rumpsteak is currently a work in progress and the API is likely to\n\u003e dramatically change. Feel free to try out examples but please do not yet use\n\u003e Rumpsteak for any production applications!\n\nRumpsteak is a Rust framework for _safely_ and _efficiently_ implementing\n[message-passing](https://doc.rust-lang.org/book/ch16-02-message-passing.html)\n[asynchronous](https://rust-lang.github.io/async-book/) programs. It uses\nmultiparty session types to statically guarantee the absence of communication\nerrors such as deadlocks and asynchronous subtyping to allow optimizing\ncommunications.\n\nMultiparty session types (MPST) verify the safety of message-passing protocols,\nas described in [A Very Gentle Introduction to Multiparty Session\nTypes](http://mrg.doc.ic.ac.uk/publications/a-very-gentle-introduction-to-multiparty-session-types/main.pdf).\nAsynchronous subtyping, introduced for MPST in [Precise Subtyping for\nAsynchronous Multiparty\nSessions](http://mrg.doc.ic.ac.uk/publications/precise-subtyping-for-asynchronous-multiparty-sessions/main.pdf),\nverifies the reordering of messages to create more optimized implementations\nthan are usually possible with MPST.\n\n## Features\n\n- [x] Provides deadlock-free communication.\n- [x] Integrates with `async`/`await` code.\n- [x] Supports any number of participants.\n- [x] Includes benchmarks to track performance.\n\n## Usage\n\nAdd the following to your `Cargo.toml` file.\n\n```toml\n[dependencies]\nrumpsteak = \"0.1\"\n```\n\n## Example\n\n```rust\nuse futures::{\n    channel::mpsc::{UnboundedReceiver, UnboundedSender},\n    executor, try_join,\n};\nuse rumpsteak::{\n    channel::Bidirectional, session, try_session, End, Message, Receive, Role, Roles, Send,\n};\nuse std::{error::Error, result};\n\ntype Result\u003cT\u003e = result::Result\u003cT, Box\u003cdyn Error\u003e\u003e;\n\ntype Channel = Bidirectional\u003cUnboundedSender\u003cLabel\u003e, UnboundedReceiver\u003cLabel\u003e\u003e;\n\n#[derive(Roles)]\nstruct Roles(C, S);\n\n#[derive(Role)]\n#[message(Label)]\nstruct C(#[route(S)] Channel);\n\n#[derive(Role)]\n#[message(Label)]\nstruct S(#[route(C)] Channel);\n\n#[derive(Message)]\nenum Label {\n    Add(Add),\n    Sum(Sum),\n}\n\nstruct Add(i32);\nstruct Sum(i32);\n\n#[session]\ntype Client = Send\u003cS, Add, Send\u003cS, Add, Receive\u003cS, Sum, End\u003e\u003e\u003e;\n\n#[session]\ntype Server = Receive\u003cC, Add, Receive\u003cC, Add, Send\u003cC, Sum, End\u003e\u003e\u003e;\n\nasync fn client(role: \u0026mut C, x: i32, y: i32) -\u003e Result\u003ci32\u003e {\n    try_session(role, |s: Client\u003c'_, _\u003e| async {\n        let s = s.send(Add(x)).await?;\n        let s = s.send(Add(y)).await?;\n        let (Sum(z), s) = s.receive().await?;\n        Ok((z, s))\n    })\n    .await\n}\n\nasync fn server(role: \u0026mut S) -\u003e Result\u003c()\u003e {\n    try_session(role, |s: Server\u003c'_, _\u003e| async {\n        let (Add(x), s) = s.receive().await?;\n        let (Add(y), s) = s.receive().await?;\n        let s = s.send(Sum(x + y)).await?;\n        Ok(((), s))\n    })\n    .await\n}\n\nfn main() {\n    let Roles(mut c, mut s) = Roles::default();\n    executor::block_on(async {\n        let (output, _) = try_join!(client(\u0026mut c, 1, 2), server(\u0026mut s)).unwrap();\n        assert_eq!(output, 3);\n    });\n}\n```\n\n## Structure\n\n#### `benches/`\n\nBenchmark suite to track Rumpsteak's performance over time.\n\n#### `caching/`\n\nHTTP cache case study backed by Redis.\n\n#### `comparison/`\n\nComparison with some other Rust implementations of session types.\n\n#### `examples/`\n\nMany examples of using Rumpsteak from popular protocols.\n\n#### `generate/`\n\nAutomatic code generation from finite state machines to Rumpsteak's API.\n\n#### `macros/`\n\nCrate for procedural macros used within Rumpsteak's API.\n\n#### `oneshot/`\n\nOutdated experimental implementation of using one-shot channels for communication.\n\n## Licensing\n\nLicensed under the MIT license. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzakcutner%2Frumpsteak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzakcutner%2Frumpsteak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzakcutner%2Frumpsteak/lists"}