{"id":27107011,"url":"https://github.com/boltlabs-inc/dialectic","last_synced_at":"2025-06-17T04:05:38.969Z","repository":{"id":43796358,"uuid":"318367729","full_name":"boltlabs-inc/dialectic","owner":"boltlabs-inc","description":"Transport-polymorphic, asynchronous session types for Rust","archived":false,"fork":false,"pushed_at":"2022-10-19T22:06:22.000Z","size":796,"stargazers_count":63,"open_issues_count":19,"forks_count":3,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-06-14T10:38:04.621Z","etag":null,"topics":["asynchronous","protocols","rust","session","types"],"latest_commit_sha":null,"homepage":"https://docs.rs/dialectic","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/boltlabs-inc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-04T01:27:25.000Z","updated_at":"2025-06-13T11:59:23.000Z","dependencies_parsed_at":"2022-07-12T18:19:38.699Z","dependency_job_id":null,"html_url":"https://github.com/boltlabs-inc/dialectic","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/boltlabs-inc/dialectic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boltlabs-inc%2Fdialectic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boltlabs-inc%2Fdialectic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boltlabs-inc%2Fdialectic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boltlabs-inc%2Fdialectic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boltlabs-inc","download_url":"https://codeload.github.com/boltlabs-inc/dialectic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boltlabs-inc%2Fdialectic/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260288463,"owners_count":22986666,"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":["asynchronous","protocols","rust","session","types"],"created_at":"2025-04-06T20:19:54.128Z","updated_at":"2025-06-17T04:05:38.932Z","avatar_url":"https://github.com/boltlabs-inc.png","language":"Rust","readme":"# Dialectic\n\n[![Rust](https://github.com/boltlabs-inc/dialectic/actions/workflows/rust.yml/badge.svg)](https://github.com/boltlabs-inc/dialectic/actions/workflows/rust.yml)\n![license: MIT](https://img.shields.io/github/license/boltlabs-inc/dialectic)\n[![crates.io](https://img.shields.io/crates/v/dialectic)](https://crates.io/crates/dialectic)\n[![docs.rs documentation](https://docs.rs/dialectic/badge.svg)](https://docs.rs/dialectic)\n\n\u003e **dialectic (noun):** The process of arriving at the truth by stating a thesis, developing a\n\u003e contradictory antithesis, and combining them into a coherent synthesis.\n\u003e\n\u003e **dialectic (crate):** Transport-polymorphic session types for asynchronous Rust.\n\nWhen two concurrent processes communicate, it's good to give their messages *types*, which\nensure every message is of an expected form.\n\n- **Conventional types** merely describe **what is valid** to communicate.\n- **Session types** describe **when it is valid** to communicate, and **in what manner**.\n\nThis crate provides a generic wrapper around almost any type of asynchronous channel that adds\ncompile-time guarantees that a specified *session protocol* will not be violated by any code\nusing the channel. Such a wrapped channel:\n\n- has **almost no runtime cost** in time or memory;\n- is **built on `async`/`.await`** to allow integration with Rust's powerful `async` ecosystem;\n- gracefully handles runtime protocol violations, introducing **no panics**;\n- allows for **full duplex concurrent communication**, if specified in its type, while\n  preserving all the same session-type safety guarantees; and\n- can even implement **context free sessions**, a more general form of session type than\n  supported by most other session typing libraries.\n\nTogether, these make Dialectic ideal for writing networked services that need to ensure **high\nlevels of availability** and **complex protocol correctness properties** in the real world,\nwhere protocols might be violated and connections might be dropped.\n\nDialectic supports a number of async runtimes and backends out-of-the-box, if you don't want to\nor don't need to write your own:\n\n- The [`dialectic-tokio-mpsc`] crate supports using Dialectic to communicate between\n  tasks using Tokio's [`mpsc`] queues.\n- The [`dialectic-tokio-serde`] crate supports using Dialectic to communicate over any [`AsyncRead`]/[`AsyncWrite`] transport layer encoded using any Tokio [`codec`]. A couple of Serde formats are already implemented, but it is easy to implement your own:\n  - [`dialectic-tokio-serde-bincode`] backend using [`bincode`] for serialization\n  - [`dialectic-tokio-serde-json`] backend using [`serde_json`] for serialization\n\nThese crates also serve as good references for writing your own backends.\n\n## What now?\n\n- If you are **new to session types** you might consider starting with the **[tutorial-style\n  tour of the crate]**.\n- If you're **familiar with session types**, you might jump to the **[quick\n  reference]**, then read more about the [`Session!`] macro for specifying session types, and\n  continue on to look at the [`types`] module and the documentation for [`Chan`].\n- You may also find helpful the **[full self-contained\n  examples](https://github.com/boltlabs-inc/dialectic/tree/main/dialectic/examples)**, which show how all\n  the features of the crate come together to build session-typed network programs.\n- If you want to **integrate your own channel type** with Dialectic, you need to implement the\n  [`Transmit`] and [`Receive`] traits from the [`backend`] module.\n- Or, you can dive into the **[reference documentation]**...\n\n[`codec`]: https://docs.rs/tokio-util/latest/tokio_util/codec/index.html\n[`mpsc`]: https://docs.rs/tokio/latest/tokio/sync/mpsc/index.html\n[`AsyncRead`]: https://docs.rs/tokio/latest/tokio/io/trait.AsyncRead.html\n[`AsyncWrite`]: https://docs.rs/tokio/latest/tokio/io/trait.AsyncWrite.html\n\n[`dialectic-tokio-mpsc`]: https://crates.io/crates/dialectic-tokio-mpsc\n[`dialectic-tokio-serde`]: https://crates.io/crates/dialectic-tokio-serde\n[`dialectic-tokio-serde-bincode`]: https://crates.io/crates/dialectic-tokio-serde-bincode\n[`dialectic-tokio-serde-json`]: https://crates.io/crates/dialectic-tokio-serde-json\n[`bincode`]: https://crates.io/crates/bincode\n[`serde_json`]: https://crates.io/crates/serde_json\n[tutorial-style tour of the crate]: https://docs.rs/dialectic/latest/dialectic/tutorial/index.html\n[quick reference]: https://docs.rs/dialectic/latest/dialectic/#quick-reference\n[reference documentation]: https://docs.rs/dialectic\n[`types`]: https://docs.rs/dialectic/latest/dialectic/types/index.html\n[`Chan`]: https://docs.rs/dialectic/latest/dialectic/struct.Chan.html\n[`Transmit`]: https://docs.rs/dialectic/latest/dialectic/backend/trait.Transmit.html\n[`Receive`]: https://docs.rs/dialectic/latest/dialectic/backend/trait.Receive.html\n[`backend`]: https://docs.rs/dialectic/latest/dialectic/backend/index.html\n[`Session!`]: https://docs.rs/dialectic/latest/dialectic/macro.Session.html\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboltlabs-inc%2Fdialectic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboltlabs-inc%2Fdialectic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboltlabs-inc%2Fdialectic/lists"}