Function maelstrom_util::net::socket_reader

source ยท
pub fn socket_reader<MessageT, TransformedT>(
    socket: impl Read,
    channel: SyncSender<TransformedT>,
    transform: impl Fn(MessageT) -> TransformedT,
)
where MessageT: DeserializeOwned,
Expand description

Loop, reading messages from a socket and writing them to an mpsc channel. The transform parameter is used to log the messages and wrap them in any necessary structure for internal use by the program.