Attribute Macro ic_cdk::post_upgrade
source · #[post_upgrade]
Expand description
Register the canister_post_upgrade
entry point of a canister.
This attribute macro will export the function canister_post_upgrade
in the canister module.
The function under this attribute must have no return value.
Each canister can only have one canister_post_upgrade
entry point.
Example
#[post_upgrade]
fn post_upgrade_function() {
// ...
}
You can specify a guard function to be executed before the post_upgrade function. When the guard function returns an error, the post_upgrade function will not proceed.
fn guard_function() -> Result<(), String> {
// ...
}
#[post_upgrade(guard = "guard_function")]
fn post_upgrade_function() {
// ...
}