Print string repr in io example

This commit is contained in:
Aode (Lion) 2022-02-11 15:15:00 -06:00
parent 9d04b5e700
commit 5ba4dab3cf

View file

@ -39,10 +39,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
break;
}
println!("{:?}: {:?}", std::thread::current().id(), &buffer[0..n]);
if let Ok(s) = std::str::from_utf8(&buffer[0..n]) {
let mut string = s.trim().chars().rev().collect::<String>();
println!("{:?}: {}", std::thread::current().id(), string);
string.push('\n');
if stream.write_all(string.as_bytes()).await.is_err() {