async fn encode_and_write<IO, T>(io: &mut IO, data: T) -> Result<()>where IO: AsyncWrite + Unpin, T: Serialize,