Crates.io | ic-cdk |
lib.rs | ic-cdk |
version | 0.17.0 |
source | src |
created_at | 2020-10-02 18:24:01.329506 |
updated_at | 2024-11-05 14:47:47.594986 |
description | Canister Developer Kit for the Internet Computer. |
homepage | https://docs.rs/ic-cdk |
repository | https://github.com/dfinity/cdk-rs |
max_upload_size | |
id | 295503 |
size | 162,200 |
Canister Developer Kit for the Internet Computer.
On the Internet Computer, smart contracts come in the form of canisters which are WebAssembly modules.
Canisters expose entry points which can be called both by other canisters and by parties external to the IC.
This library aims to provide a Rust-ergonomic abstraction to implement Canister entry points.
ic-cdk
In Cargo.toml:
[lib]
crate-type = ["cdylib"]
[dependencies]
ic-cdk = "0.15"
candid = "0.10" # required if you want to define Candid data types
Then in Rust source code:
#[ic_cdk::query]
fn hello() -> String {
"world".to_string()
}
This will register a query entry point named hello
.
This library re-exports macros defined in ic-cdk-macros
crate.
The macros fall into two categories:
These macros are directly related to the Internet Computer Specification.
Check Generating Candid files for Rust canisters for more details.
ic-cdk
API.Using the ic_cdk::storage::{stable_save, stable_restore}
API is easy but it doesn't scale well.
ic-stable-structures
is recommended when you are dealing with multiple data structures with larger datasets.