Skip to content

Commit a788429

Browse files
djcRalith
authored andcommitted
book: order data-transfer code in top-down order
1 parent 6b6d115 commit a788429

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

docs/book/src/bin/data-transfer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use bytes::Bytes;
22
use quinn::Connection;
33

4+
fn main() {}
5+
46
#[allow(dead_code, unused_variables)] // Included in `data-transfer.md`
57
async fn open_bidirectional_stream(connection: Connection) -> anyhow::Result<()> {
68
let (mut send, mut recv) = connection.open_bi().await?;
@@ -52,5 +54,3 @@ async fn receive_datagram(connection: Connection) -> anyhow::Result<()> {
5254
}
5355
Ok(())
5456
}
55-
56-
fn main() {}

docs/book/src/quinn/data-transfer.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ For example, from the connection initiator to the peer and the other way around.
3434
_open bidirectional stream_
3535

3636
```rust
37-
{{#include ../bin/data-transfer.rs:5:11}}
37+
{{#include ../bin/data-transfer.rs:7:13}}
3838
```
3939

4040
_iterate incoming bidirectional stream(s)_
4141

4242
```rust
43-
{{#include ../bin/data-transfer.rs:14:22}}
43+
{{#include ../bin/data-transfer.rs:16:24}}
4444
```
4545

4646
## Unidirectional Streams
@@ -51,13 +51,13 @@ It is possible to get reliability without ordering (so no head-of-line blocking)
5151
_open unidirectional stream_
5252

5353
```rust
54-
{{#include ../bin/data-transfer.rs:25:30}}
54+
{{#include ../bin/data-transfer.rs:27:32}}
5555
```
5656

5757
_iterating incoming unidirectional stream(s)_
5858

5959
```rust
60-
{{#include ../bin/data-transfer.rs:33:39}}
60+
{{#include ../bin/data-transfer.rs:35:41}}
6161
```
6262

6363
## Unreliable Messaging
@@ -68,13 +68,13 @@ This could be useful if data arrival isn't essential or when high throughput is
6868
_send datagram_
6969

7070
```rust
71-
{{#include ../bin/data-transfer.rs:42:45}}
71+
{{#include ../bin/data-transfer.rs:44:47}}
7272
```
7373

7474
_iterating datagram stream(s)_
7575

7676
```rust
77-
{{#include ../bin/data-transfer.rs:48:54}}
77+
{{#include ../bin/data-transfer.rs:50:56}}
7878
```
7979

8080
[Endpoint]: https://docs.rs/quinn/latest/quinn/struct.Endpoint.html

0 commit comments

Comments
 (0)