{"id":13439257,"url":"https://github.com/capnproto/capnproto-rust","last_synced_at":"2025-12-12T14:26:28.915Z","repository":{"id":9333674,"uuid":"11180435","full_name":"capnproto/capnproto-rust","owner":"capnproto","description":"Cap'n Proto for Rust","archived":false,"fork":false,"pushed_at":"2025-04-28T10:32:24.000Z","size":8227,"stargazers_count":2195,"open_issues_count":79,"forks_count":229,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-05-07T10:52:33.990Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/capnproto.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,"zenodo":null}},"created_at":"2013-07-04T15:16:00.000Z","updated_at":"2025-05-06T13:30:40.000Z","dependencies_parsed_at":"2023-11-15T01:44:31.503Z","dependency_job_id":"76252b15-bc61-4a1e-9a53-6a1c77265c59","html_url":"https://github.com/capnproto/capnproto-rust","commit_stats":{"total_commits":3106,"total_committers":85,"mean_commits":36.54117647058823,"dds":0.3676754668383774,"last_synced_commit":"5a1502652bcc3b48a7ea600949fa648d44d82940"},"previous_names":["dwrensha/capnproto-rust"],"tags_count":275,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capnproto%2Fcapnproto-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capnproto%2Fcapnproto-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capnproto%2Fcapnproto-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capnproto%2Fcapnproto-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capnproto","download_url":"https://codeload.github.com/capnproto/capnproto-rust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254129479,"owners_count":22019628,"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":[],"created_at":"2024-07-31T03:01:12.414Z","updated_at":"2025-12-12T14:26:28.860Z","avatar_url":"https://github.com/capnproto.png","language":"Rust","funding_links":[],"categories":["Libraries","Rust","库 Libraries","库","others","Libraries and Frameworks"],"sub_categories":["Encoding","编码 Encoding","编码(Encoding)","加密 Encoding"],"readme":"# Cap'n Proto for Rust\n\n[![Build Status](https://github.com/capnproto/capnproto-rust/workflows/CI/badge.svg?branch=master\u0026event=push)](https://github.com/capnproto/capnproto-rust/actions?query=workflow%3ACI)\n\n[documentation](https://docs.rs/capnp/)\n\nFor the latest news,\nsee the [capnproto-rust blog](https://dwrensha.github.io/capnproto-rust).\n\n## Introduction\n\n[Cap'n Proto](https://capnproto.org) is a type system for distributed systems.\n\nWith Cap'n Proto, you describe your data and interfaces\nin a [schema file](https://capnproto.org/language.html), like this:\n\n```capnp\n@0x986b3393db1396c9;\n\nstruct Point {\n    x @0 :Float32;\n    y @1 :Float32;\n}\n\ninterface PointTracker {\n    addPoint @0 (p :Point) -\u003e (totalPoints :UInt64);\n}\n```\n\nYou can then use the [capnp tool](https://capnproto.org/capnp-tool.html#compiling-schemas)\nto generate code in a [variety of programming languages](https://capnproto.org/otherlang.html).\nThe generated code lets you produce and consume values of the\ntypes you've defined in your schema.\n\nValues are encoded in [a format](https://capnproto.org/encoding.html) that\nis suitable not only for transmission over a network and persistence to disk,\nbut also for zero-copy in-memory traversal.\nThat is, you can completely skip serialization and deserialization!\nIt's in this sense that Cap'n Proto is\n[\"infinity times faster\"](https://capnproto.org/news/2013-04-01-announcing-capn-proto.html)\nthan alternatives like Protocol Buffers.\n\nIn Rust, the generated code for the example above includes\na `point::Reader\u003c'a\u003e` struct with `get_x()` and `get_y()` methods,\nand a `point::Builder\u003c'a\u003e` struct with `set_x()` and `set_y()` methods.\nThe lifetime parameter `'a` is a formal reminder\nthat `point::Reader\u003c'a\u003e` and `point::Builder\u003c'a\u003e`\ncontain borrowed references to the raw buffers that contain the encoded messages.\nThose underlying buffers are never actually copied into separate data structures.\n\nThe generated code for the example above also includes\na `point_tracker::Server` trait with an `add_point()` method,\nand a `point_tracker::Client` struct with an `add_point_request()` method.\nThe former can be implemented to create a network-accessible object,\nand the latter can be used to invoke a possibly-remote instance of a `PointTracker`.\n\n## Features\n\n- [tagged unions](https://capnproto.org/language.html#unions)\n- [generics](https://capnproto.org/language.html#generic-types)\n- [protocol evolvability](https://capnproto.org/language.html#evolving-your-protocol)\n- [canonicalization](https://capnproto.org/encoding.html#canonicalization)\n- [`Result`-based error handling](https://dwrensha.github.io/capnproto-rust/2015/03/21/error-handling-revisited.html)\n- [`no_std` support](https://dwrensha.github.io/capnproto-rust/2020/06/06/no-std-support.html)\n- [no-alloc support](https://dwrensha.github.io/capnproto-rust/2023/09/04/0.18-release.html)\n- [reflection](https://dwrensha.github.io/capnproto-rust/2023/05/08/run-time-reflection.html)\n\n## Crates\n\n|  |  |  |\n| ----- | ---- | ---- |\n| [capnp](/capnp) | Runtime library for dealing with Cap'n Proto messages. | [![crates.io](https://img.shields.io/crates/v/capnp.svg)](https://crates.io/crates/capnp) |\n| [capnpc](/capnpc) | Rust code generator [plugin](https://capnproto.org/otherlang.html#how-to-write-compiler-plugins), including support for hooking into a `build.rs` file in a `cargo` build. | [![crates.io](https://img.shields.io/crates/v/capnpc.svg)](https://crates.io/crates/capnpc) |\n| [capnp-futures](/capnp-futures) | Support for asynchronous reading and writing of Cap'n Proto messages. | [![crates.io](https://img.shields.io/crates/v/capnp-futures.svg)](https://crates.io/crates/capnp-futures) |\n| [capnp-rpc](/capnp-rpc) | Object-capability remote procedure call system with [\"level 1\"](https://capnproto.org/rpc.html#protocol-features) features. | [![crates.io](https://img.shields.io/crates/v/capnp-rpc.svg)](https://crates.io/crates/capnp-rpc) |\n\n## Examples\n\n[addressbook serialization](/example/addressbook),\n[RPC](/capnp-rpc/examples)\n\n## Who is using capnproto-rust?\n\n- Sandstorm's [raw API example app](https://github.com/dwrensha/sandstorm-rawapi-example-rust) and\n  [collections app](https://github.com/sandstorm-io/collections-app)\n- [juice](https://github.com/spearow/juice)\n- [combustion-engine](https://github.com/combustion-engine/combustion/tree/master/combustion_protocols)\n\n## Unimplemented / Future Work\n\n- [orphans](https://capnproto.org/cxx.html#orphans)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapnproto%2Fcapnproto-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapnproto%2Fcapnproto-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapnproto%2Fcapnproto-rust/lists"}