This project contains various implementation for the same canister interface Counter.
dfx start --clean --background
dfx deploy
dfx canister call <CANISTER_NAME> read
dfx canister call <CANISTER_NAME> inc
dfx canister call <CANISTER_NAME> read
...
dfx stop
The baseline implementation which illustrates how the macro works.
Instead of calling macro, we may want to use build.rs which generate the binding in OUT_DIR.
If we want to allow bindgen configuration, build.rs is more convenient than macro.
The struct has state and the trait required methods take &self or &mut self in argument.
Note: Depends on once_cell crate to make sure that only one instance of the Canister.
The approach can work well with async.