Skip to content

API Reference — Mailbox

New to the concept? See Building Blocks — Mailbox first.

Moves handles between Masters.

const mailbox = @import("matryoshka").mailbox;

// typical usage:
var slot: polynode.Slot = &event.poly;
try mailbox.send(inbox, &slot);              // slot is now null
try mailbox.receive(inbox, &slot, null);     // slot is now non-null

Types

pub const MailboxHandle = ItemHandle;

MailboxHandle is itself a *PolyNode.
A mailbox can be:

  • sent through another mailbox
  • stored in pools
  • embedded into larger structures

Same rules as application items.


new

pub fn new(io: Io, alloc: std.mem.Allocator) !MailboxHandle
  • Creates a new mailbox.
  • Stores io internally.

Next: send / send_oob.