#TIL that the Read implementation for TcpStream in #Rust only reads two bytes at a time and read_to_string is like read_to_end, so it waits for EOF. There is no read_line.

Suivre

@Koehr Are you looking for trait std::io::BufRead?

· · Web · 1 · 0 · 0

@kmk exactly. It's not implemented for TcpStream so I just wrote it on my own.

@Koehr BufReader is supposed to wrap any Read into a BufRead. TcpStream is a Read so it should work with. Doesn't it?

@kmk maybe I'm just too stupid to use it the right way. I'll check it out. thanks.

Inscrivez-vous pour prendre part à la conversation
Framapiaf

Le réseau social de l'avenir : Pas d'annonces, pas de surveillance institutionnelle, conception éthique et décentralisation ! Possédez vos données avec Mastodon !