Skip to content

hypermynds/rotors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rotors

Latest Version Latest Version Apache 2.0 OR MIT licensed

Rust PROTOcols without the Pain

Why should I use this library?

You probably shouldn't, because this library is under development and has not gone through serious scrutiny yet.

However, if you would like an easier way to use native Rust types inside a tonic project, this might be useful to you.

How should I use this library?

Instead of writing a gRPC xyz.proto file and using the tonic-build tools in your build.rs, you can just use a simple macro in your code, and let the macro do most of the heavy lifting!

use rotors::rotors;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HelloRequest {
    pub name: String,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HelloReply {
    pub message: String,
}

rotors! {
    package helloworld;

    service Greeter {
        rpc SayHello (super::HelloRequest) returns (super::HelloReply);
    }
}

The rotors!() macro will define two new rust modules, containing the tonic client and server structures. From there onwards, everything will be just like the tonic you are used to, except that you are finally free to write your own enums without the tedious boilerplate required by gRPC.

When should I use this library?

When using rotors you are creating some RPC code that is now NOT COMPATIBLE with gRPC. If this is fine for you, then go for it!

On the other hand, if you are writing a big project, or want to communicate between instances running different versions of your software, or even sofware written in different languages, this crate won't be of much use to you.

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages