pub async fn write_message<W, T>(writer: &mut W, msg: &T) -> Result<()>where W: AsyncWrite + Unpin, T: Serialize,
Write a length-prefixed CBOR message to an async writer.