kw activate
Contextual keyword — on … in an actor (§12.5)
The list of words: §1.4
Syntax
ActorMember = { Attr } ( "var" Ident ":" Type "=" Expr | "dep" Ident ":" Type
| "msg" Ident "(" [ Params ] ")" [ "->" Type ] Block
| "on" ( "activate" | "passivate" ) Block ) ;Grammar: App. A
Defined in
- 1.4 Keywords — Reserved (cannot be used as names)
- 12.5 Sharded actors — The key is declared in the header (sharded by name
Examples
@idle(ACCOUNT_IDLE)
actor Account sharded by id: AccountId {
var balance: Money = Money.zero()
@transient var hits: u64 = 0
on activate { log.debug("account {id} up") }
msg deposit(x: Money) { balance += x }
msg balance() -> Money { balance }
}
Account(id).deposit(amount)