forked from mirror/async-std
Fuse futures in select!
This commit is contained in:
parent
17534cfffc
commit
85b80cfe9a
1 changed files with 2 additions and 2 deletions
|
@ -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…
Reference in a new issue