Fuse futures in select!

staging
Stjepan Glavina 5 years ago
parent 17534cfffc
commit 85b80cfe9a

@ -39,14 +39,14 @@ async fn try_run(addr: impl ToSocketAddrs) -> Result<()> {
let mut lines_from_stdin = BufReader::new(stdin()).lines().fuse(); // 2 let mut lines_from_stdin = BufReader::new(stdin()).lines().fuse(); // 2
loop { loop {
select! { // 3 select! { // 3
line = lines_from_server.next() => match line { line = lines_from_server.next().fuse() => match line {
Some(line) => { Some(line) => {
let line = line?; let line = line?;
println!("{}", line); println!("{}", line);
}, },
None => break, None => break,
}, },
line = lines_from_stdin.next() => match line { line = lines_from_stdin.next().fuse() => match line {
Some(line) => { Some(line) => {
let line = line?; let line = line?;
writer.write_all(line.as_bytes()).await?; writer.write_all(line.as_bytes()).await?;

Loading…
Cancel
Save