This repository was archived by the owner on Sep 5, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 7
7
8
8
In this tutorial, we will implement an asynchronous chat on top of async-std.
9
9
10
+ https://htmlpreview.github.io/?https://raw.githubusercontent.com/async-std/a-chat/master/README.html?token=AANB3M5MMJ5DZVW74H2CX2K5LLLYS[HTML version]
11
+
10
12
== Specification
11
13
12
14
The chat uses a simple text protocol over TCP.
@@ -349,7 +351,7 @@ async fn broker(mut events: Receiver<Event>) -> Result<()> {
349
351
Note how we don't need a `Mutex` here and can confidently say, at each iteration of the broker's loop, what is the current set of peers
350
352
<3> To handle a message we send it over a channel to each destination
351
353
<4> To handle new peer, we first register it in the peer's map ...
352
- <4 > ... and then spawn a dedicated task to actually write the messages to the socket.
354
+ <5 > ... and then spawn a dedicated task to actually write the messages to the socket.
353
355
354
356
== All Together
355
357
@@ -937,4 +939,4 @@ async fn try_main(addr: impl ToSocketAddrs) -> Result<()> {
937
939
938
940
<1> Here we split `TcpStream` into read and write halfs: there's `impl AsyncRead for &'_ TcpStream`, just like the one in std.
939
941
<2> We crate a steam of lines for both the socket and stdin.
940
- <3> In the main select loop, we print the lines we receive from server and send the lines we read from the console.
942
+ <3> In the main select loop, we print the lines we receive from server and send the lines we read from the console.
Original file line number Diff line number Diff line change @@ -447,6 +447,9 @@ <h1>a-chat tutorial</h1>
447
447
< div class ="paragraph ">
448
448
< p > In this tutorial, we will implement an asynchronous chat on top of async-std.</ p >
449
449
</ div >
450
+ < div class ="paragraph ">
451
+ < p > < a href ="https://htmlpreview.github.io/?https://raw.githubusercontent.com/async-std/a-chat/master/README.html?token=AANB3M5MMJ5DZVW74H2CX2K5LLLYS "> HTML version</ a > </ p >
452
+ </ div >
450
453
</ div >
451
454
</ div >
452
455
< div class ="sect1 ">
You can’t perform that action at this time.
0 commit comments