mirror of https://github.com/stjepang/smol
Replace writer() with Unblock
This commit is contained in:
parent
4a18f3cb37
commit
1520334346
|
@ -11,7 +11,7 @@ fn main() -> std::io::Result<()> {
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use async_io::Async;
|
use async_io::Async;
|
||||||
use blocking::block_on;
|
use blocking::{block_on, Unblock};
|
||||||
use futures::io;
|
use futures::io;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use smol::Task;
|
use smol::Task;
|
||||||
|
@ -24,7 +24,7 @@ fn main() -> std::io::Result<()> {
|
||||||
println!("Connected to {:?}", stream.get_ref().peer_addr()?);
|
println!("Connected to {:?}", stream.get_ref().peer_addr()?);
|
||||||
|
|
||||||
// Pipe the stream to stdout.
|
// Pipe the stream to stdout.
|
||||||
let mut stdout = smol::writer(std::io::stdout());
|
let mut stdout = Unblock::new(std::io::stdout());
|
||||||
io::copy(&stream, &mut stdout).await?;
|
io::copy(&stream, &mut stdout).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue