mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-27 00:00:12 +02:00
examples: use write_all instead of write in hello world example (#5044)
This commit is contained in:
@@ -26,7 +26,7 @@ pub async fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
let mut stream = TcpStream::connect("127.0.0.1:6142").await?;
|
let mut stream = TcpStream::connect("127.0.0.1:6142").await?;
|
||||||
println!("created stream");
|
println!("created stream");
|
||||||
|
|
||||||
let result = stream.write(b"hello world\n").await;
|
let result = stream.write_all(b"hello world\n").await;
|
||||||
println!("wrote to stream; success={:?}", result.is_ok());
|
println!("wrote to stream; success={:?}", result.is_ok());
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user