volo-build

Compile thrift and protobuf idls into rust code at compile-time

45 releases

0.10.15 Sep 18, 2024
0.10.12 Jul 29, 2024
0.9.5 Feb 27, 2024
0.9.1 Dec 25, 2023
0.2.1 Oct 26, 2022

#167 in Procedural macros

Download history 53/week @ 2024-07-01 219/week @ 2024-07-08 117/week @ 2024-07-15 208/week @ 2024-07-22 249/week @ 2024-07-29 48/week @ 2024-08-05 103/week @ 2024-08-12 71/week @ 2024-08-19 402/week @ 2024-08-26 81/week @ 2024-09-02 73/week @ 2024-09-09 258/week @ 2024-09-16 187/week @ 2024-09-23 150/week @ 2024-09-30 21/week @ 2024-10-07 66/week @ 2024-10-14

457 downloads per month
Used in 4 crates (3 directly)

MIT/Apache

270KB
6.5K SLoC

Volo

volo-build compiles thrift and protobuf idl files into rust code at compile-time.

Example

Usually, if you are using volo-cli to generate the code, you don't need to use volo-build directly.

If you want to use volo-build directly, you can follow the following steps:

First, add volo-build to your Cargo.toml:

[build-dependencies]
volo-build = "*" # make sure you use a compatible version with `volo`

Second, creates a build.rs file:

fn main() {
    volo_build::Builder::default().write().unwrap();
}

Third, creates a volo.yml file in the same directory of build.rs with the following layout:

---
idls:
  - source: local
    path: path/to/your/idl.thrift
  - source: local
    path: path/to/your/protobuf/idl.proto
    includes:
    - path/to/your/protobuf/
  - source: git
    repo: git@github.com:cloudwego/volo.git
    ref: main
    path: path/in/repo/idl.thrift

That's it!

Dependencies

~33–47MB
~814K SLoC