Available on crate feature
deploy and (crate features maelstrom or maelstrom_runtime) only.Expand description
Runtime support for Maelstrom deployment backend.
This module provides the runtime code that runs inside Maelstrom nodes, handling stdin/stdout JSON message passing according to the Maelstrom protocol.
Structs§
- Init
Body - Maelstrom init message body.
- Init
OkBody - Maelstrom init_ok response body.
- Maelstrom
Message - Maelstrom message envelope structure.
- Maelstrom
Meta - Metadata for a Maelstrom node, populated from the init message. Also manages a shared stdin reader that broadcasts lines to multiple subscribers.
Functions§
- maelstrom_
client_ source - Creates a stream of client messages from Maelstrom stdin. Returns tuples of (client_id, message_body) where client_id is the source client and message_body is the JSON value of the message body.
- maelstrom_
init - Initialize a Maelstrom node by reading the init message from stdin. Returns the node metadata and sends init_ok response. Also spawns a background thread to read stdin and broadcast lines to subscribers.
- maelstrom_
send_ response - Sends a response to a Maelstrom client via stdout.