4 releases

0.1.3 Feb 27, 2024
0.1.2 Nov 23, 2023
0.1.1 Sep 18, 2023
0.1.0 Jul 13, 2023

#1795 in Magic Beans

Download history 159/week @ 2024-03-13 133/week @ 2024-03-20 67/week @ 2024-03-27 148/week @ 2024-04-03 108/week @ 2024-04-10 182/week @ 2024-04-17 159/week @ 2024-04-24 110/week @ 2024-05-01 97/week @ 2024-05-08 107/week @ 2024-05-15 294/week @ 2024-05-22 159/week @ 2024-05-29 154/week @ 2024-06-05 164/week @ 2024-06-12 148/week @ 2024-06-19 183/week @ 2024-06-26

673 downloads per month

Apache-2.0

8KB
109 lines

ic-cdk-bindgen

Generate Rust bindings from Candid to make inter-canister calls.

How to use

  1. Canister project add ic-cdk-bindgen as a build dependency.
[build-dependencies]
ic-cdk-bindgen = "0.1"
  1. Add build.rs to generate Rust bindings in the source directory with config options.
use ic_cdk_bindgen::{Builder, Config};
fn main() {
    let counter = Config::new("counter");
    let mut builder = Builder::new();
    builder.add(counter);
    builder.build(None);  // default write to src/declarations
}
  1. In Canister code,
mod declarations;
use declarations::counter::counter;

counter.inc().await?

Dependencies

~4–14MB
~135K SLoC