Skip to main content

async_socket_reader

Function async_socket_reader 

Source
pub async fn async_socket_reader<MessageT, TransformedT>(
    socket: impl AsyncRead + Unpin,
    channel: UnboundedSender<TransformedT>,
    transform: impl Fn(MessageT) -> TransformedT,
    log: Logger,
    context: &'static str,
) -> Result<()>
where MessageT: Debug + 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.