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