Function maelstrom_util::net::async_socket_reader

source ยท
pub async fn async_socket_reader<MessageT, TransformedT>(
    socket: impl AsyncRead + Unpin,
    channel: UnboundedSender<TransformedT>,
    transform: impl Fn(MessageT) -> TransformedT,
) -> Result<()>
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.