Local typed actors with bounded mailboxes for the Moon-Lander framework
| Package | Alias | Targets | Contents |
|---|---|---|---|
| moonrockz/moon-lander-actors | @policy | wasm, wasm-gc, js, native | Checked policy values: MailboxCapacity, MessageCount, MailboxPolicy, Admission |
| moonrockz/moon-lander-actors/runtime | @actors | wasm, js, native | Scopes, actors, references, replies and Receive values. See the runtime guide |
graph LR
core[moon-lander-core] --> policy["actors (policy, portable)"]
policy --> runtime["actors/runtime"]
async[moonbitlang/async] --> runtime///|
test "a capacity is positive" {
assert_eq(@policy.MailboxCapacity::from_int(1).to_int(), 1)
let rejected = try {
ignore(@policy.MailboxCapacity::from_int(0))
None
} catch {
InvalidCapacity(input~, rule=NotPositive) => Some(input)
InvalidCount(..) => None
}
assert_eq(rejected, Some(0))
}///|
test "the default policy is bounded at 128" {
guard @policy.MailboxPolicy::default() is Bounded(capacity) else {
fail("the default is unbounded")
}
assert_eq(capacity.to_int(), 128)
assert_true(@policy.MailboxPolicy::Unbounded != @policy.MailboxPolicy::default())
}