#canister #dfinity #internet-computer #ic #subcanister

bity-ic-canister-state-macros

Description spécifique de la crate

1 unstable release

new 0.1.0 Mar 14, 2025

#9 in #subcanister

MIT license

7KB

Module for managing canister state in Internet Computer canisters.

This module provides a macro for creating thread-safe state management in canisters, with functions for initialization, reading, and modifying the state.

Example

use bity_dfinity_library::canister_state_macros::canister_state;

struct MyState {
    counter: u64,
}

canister_state!(MyState);

fn init() {
    init_state(MyState { counter: 0 });
}

fn increment() {
    mutate_state(|state| state.counter += 1);
}

No runtime deps