How to provide a canister with constructor arguments?

In rust we can declare a function with #[init] annotation - this function will be called right after canister’s code installation - so it works like a constructor.

How can I pass arguments to this function?

If you deploy with dfx, run

dfx deploy --no-wallet --argument '(…your args here…)'
3 Likes