Skip to main content

Module deploy_runtime_maelstrom

Module deploy_runtime_maelstrom 

Source
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§

InitBody
Maelstrom init message body.
InitOkBody
Maelstrom init_ok response body.
MaelstromMessage
Maelstrom message envelope structure.
MaelstromMeta
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.