GithubHelp home page GithubHelp logo

paulnice / capnproto-rust Goto Github PK

View Code? Open in Web Editor NEW

This project forked from capnproto/capnproto-rust

0.0 0.0 0.0 7.42 MB

Cap'n Proto for Rust

License: MIT License

Shell 0.03% Rust 92.33% CSS 0.20% Cap'n Proto 7.39% HTML 0.06%

capnproto-rust's Introduction

Cap'n Proto for Rust

Build Status

documentation

For the latest news, see the capnproto-rust blog.

Introduction

Cap'n Proto is a type system for distributed systems.

With Cap'n Proto, you describe your data and interfaces in a schema file, like this:

@0x986b3393db1396c9;

struct Point {
    x @0 :Float32;
    y @1 :Float32;
}

interface PointTracker {
    addPoint @0 (p :Point) -> (totalPoints :UInt64);
}

You can then use the capnp tool to generate code in a variety of programming languages. The generated code lets you produce and consume values of the types you've defined in your schema.

Values are encoded in a format that is suitable not only for transmission over a network and persistence to disk, but also for zero-copy in-memory traversal. That is, you can completely skip serialization and deserialization! It's in this sense that Cap'n Proto is "infinity times faster" than alternatives like Protocol Buffers.

In Rust, the generated code for the example above includes a point::Reader<'a> struct with get_x() and get_y() methods, and a point::Builder<'a> struct with set_x() and set_y() methods. The lifetime parameter 'a is a formal reminder that point::Reader<'a> and point::Builder<'a> contain borrowed references to the raw buffers that contain the encoded messages. Those underlying buffers are never actually copied into separate data structures.

The generated code for the example above also includes a point_tracker::Server trait with an add_point() method, and a point_tracker::Client struct with an add_point_request() method. The former can be implemented to create a network-accessible object, and the latter can be used to invoke a possibly-remote instance of a PointTracker.

Features

Crates

capnp Runtime library for dealing with Cap'n Proto messages. crates.io
capnpc Rust code generator plugin, including support for hooking into a build.rs file in a cargo build. crates.io
capnp-futures Support for asynchronous reading and writing of Cap'n Proto messages. crates.io
capnp-rpc Object-capability remote procedure call system with "level 1" features. crates.io

Examples

addressbook serialization, RPC

Who is using capnproto-rust?

Unimplemented / Future Work

capnproto-rust's People

Contributors

dwrensha avatar danieleades avatar kali avatar marmeladema avatar ysimonson avatar danburkert avatar dzfranklin avatar comath avatar bspeice avatar balderk avatar yorickjh avatar maurer avatar kabergstrom avatar bromeon avatar ariel-miculas avatar appaquet avatar couchand avatar jannickj avatar ryman avatar b00f avatar tamird avatar dependabot[bot] avatar king6cong avatar zh-jq-b avatar tjkierzkowski avatar vks avatar nwalfield avatar ian-p-cooke avatar erickt avatar dkg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.