module Earl::Mailbox(M)

Overview

Extends an agent with a mailbox that receives messages of type M.

NOTE agents must use the #receive : M and #receive? : M? methods to take messages from the mailbox —undocumented because they're protected.

Direct including types

Defined in:

mailbox.cr

Instance Method Summary

Instance Method Detail

def mailbox=(mailbox : Channel(M)) : Channel(M) #

Replaces the mailbox. The mailbox won't be closed automatically when the agent is asked to stop.


[View source]
def send(message : M) : Nil #

Send a message to the Agent. Raises if the mailbox is closed.


[View source]