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

#12 in #cdk

Download history 286/week @ 2024-07-29 292/week @ 2024-08-05 98/week @ 2024-08-12 224/week @ 2024-08-19 304/week @ 2024-08-26 308/week @ 2024-09-02 197/week @ 2024-09-09 148/week @ 2024-09-16 242/week @ 2024-09-23 154/week @ 2024-09-30 172/week @ 2024-10-07 24/week @ 2024-10-14 152/week @ 2024-10-21 148/week @ 2024-10-28 182/week @ 2024-11-04 378/week @ 2024-11-11

861 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

~6–16MB
~165K SLoC