Giter VIP home page Giter VIP logo

capnp.nim's Introduction

capnp.nim

Cap'n Proto bindings for Nim

capnp.nim is a Nim implementation of Cap'n Proto serialization scheme and RPC protocol.

The serialization layer is production ready. The RPC layers is also fairly well tested, enough to be useful, but not the whole protocol is implemented.

The main user of this library is MetaContainer.

Installing

Use nimble to install capnp.nim:

nimble install capnp

Create symlink to canpnc binary result (capnp compiler expects capnpc-nim binary, but Nimble is unable to produce binary name that contains -):

ln -s ~/.nimble/bin/capnpc ~/.nimble/bin/capnpc-nim

Generating wrapping code

capnp.nim can generate Nim types (with some metadata) from .capnp file. The resulting objects use native Nim datatypes like seq or strings (this means that this implementation, unlike C++ one, doesn't have O(1) deserialization time).

capnp compile -onim your-protocol-file.capnp > you-output-file.nim

Using the library

import persondef, capnp
# unpack the raw serialized data
let p: Person = newUnpackerFlat(packed).unpackStruct(0, Person)
# and pack again
let packed2 = packStruct(p)

Debugging options

Define the following symbols during compilation (e.g -d:caprpcTraceMessages):

  • caprpcTraceMessages - print all messages sent by RPC system
  • caprpcTraceLifetime - print info about release messages, useful while debugging cross-machine leaks
  • caprpcPrintExceptions - print exceptions raised inside called methods (server)

capnp.nim's People

Contributors

iwanbk avatar zielmicha avatar

Watchers

 avatar  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.