/// Convenience wrapper that receives a message and converts it into a Message
Convenience wrapper that receives a message and converts it into a Message
Convenience wrapper that receives a message and converts it into a Message
pub async fn receive_message(socket: &mut TcpStream) -> Result<Message> {
    let payload_bytes = receive_bytes(socket).await?;
    // Deserialize the message
    let message = String::from_utf8(payload_bytes)?;
    debug!("Received message: {:?}", message);
    let message: Message = serde_json::from_str(&message)?;
    Ok(message)
}
pub async fn receive_message ( socket : & mut TcpStream ) -> Result < Message > { let payload_bytes = receive_bytes ( socket ) . await ? ; // Deserialize the message let message = String :: from_utf8 ( payload_bytes ) ? ; debug ! ( " " message ) ; let message : Message = serde_json :: from_str ( & message ) ? ; Ok ( message ) }
Convenience wrapper that receives a message and converts it into a Message
Convenience wrapper that receives a message and converts it into a Message
socket
&mut TcpStream