OxL Справочник OxL
РусскийEnglish

data ActorRef

Reference to a local actor (§8.8); messages are sent with method-call syntax.

Example:

oxl✓ проверяется в CI
actor Counter {
  var n: i64 = 0
  msg bump() -> i64 {
    n += 1
    n
  }
}

provide ActorRef<Counter> = spawn Counter()

fn main() io {
  let c: ActorRef<Counter> = spawn Counter()
  c.bump()
  print("{c.bump()}")
}
Вывод
2
@builtin("ActorRef") pub(api) data ActorRef<A>

Потокобезопасность. copyable; messages are processed one at a time by the actor.

С версии. 1.0.0-beta

Определено в: std/core/types.oxl:518

См. также