I want to send json with TcpStream and I'm using something like this everytime:
let json_str = serde_json::to_string(&json)?;
stream.write(json_str.as_bytes()).await?;
I want to write an extension to WriteExt like this:
stream.write_json(&json);
And inside of it, it will do exactly written above. Can you give me any idea how can I do it? I tried to write a helper trait but couldn't manage. Thanks a lot!