Skip to main content

start

Macro start 

Source
macro_rules! start {
    ($(init = $init:block)? $(,)?) => { ... };
}
Expand description

Configure lifecycle hooks for Canic canisters.

The canister role comes from [package.metadata.canic] role = "..." in the crate manifest and is emitted by canic::build! at compile time. role = "root" selects root lifecycle adapters and endpoint bundles; every other role selects non-root lifecycle adapters and endpoint bundles.

This macro defines the IC-required init and post_upgrade entry points at the crate root and immediately delegates lifecycle semantics to runtime adapters after performing minimal bootstrap.

IMPORTANT:

  • This macro must remain thin
  • It must not perform orchestration
  • It must not perform async work inline
  • It must not encode policy
  • It may schedule async hooks via timers, but must never await them

Its sole responsibility is to bridge IC lifecycle hooks to runtime code.