1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Realm's high performance IO collections.
//!
//! ## Example
//!
//! ```no_run
//! async {
//! use tokio::net::TcpStream;
//! use realm_io::{bidi_copy, bidi_zero_copy, bidi_copy_buf};
//! use realm_io::{Pipe, CopyBuffer};
//!
//! let mut left = TcpStream::connect("abc").await.unwrap();
//! let mut right = TcpStream::connect("def").await.unwrap();
//!
//! // direct copy
//! bidi_copy(&mut left, &mut right).await;
//!
//! // zero copy
//! bidi_zero_copy(&mut left, &mut right).await;
//!
//! // use custom buffer(AsMut<[u8]>)
//! let buf1 = CopyBuffer::new(vec![0; 0x2000]);
//! let buf2 = CopyBuffer::new(vec![0; 0x2000]);
//! bidi_copy_buf(&mut left, &mut right, buf1, buf2).await;
//!
//! // use custom buffer(Pipe or &mut Pipe)
//! let buf1 = CopyBuffer::new(Pipe::new().unwrap());
//! let buf2 = CopyBuffer::new(Pipe::new().unwrap());
//! bidi_copy_buf(&mut left, &mut right, buf1, buf2).await;
//! };
//! ```
//!
//! ## About Brutal Shutdown
//!
//! By default, [`bidi_copy_buf`] and other IO functions perform a **graceful shutdown**.
//!
//! With the feature `brutal-shutdown` enabled, these IO functions will decide to
//! perform a **brutal shutdown** once a `FIN` packet reaches, which will forcefully
//! close two connections on both sides without waiting for a reply packet.
//!
//! This is helpful when handling connections from a poorly implemented client or server,
//! which may never shutdown its write side nor close the underlying socket.
//!
pub use ;
pub use bidi_copy_buf;
pub use ;
pub use ;