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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! This crate implements a general-purpose asynchronous socket.
//!
//! The `Socket` implements [AsyncRead], [AsyncWrite], [Stream] and [Clone]
//! traits and thus mimics the functionality and the behaviour of the
//! [TcpStream] and [UnixStream] objects. These propertis makes it a perfect
//! tool for testing network activities and events.
//!
//! [](https://docs.rs/async-socket)
//! [](https://github.com/xpepermint/async-socket-rs)
//!
//! ### Usage
//!
//! **Example:**
//!
//! ```rust
//! use async_socket::Socket;
//! use async_std::task::spawn;
//! use futures::io::AsyncWriteExt;
//! use futures::stream::StreamExt;
//!
//! async fn example() {
//! let mut stream = Socket::default();
//! let mut writer = stream.clone();
//!
//! spawn(async move {
//! writer.write(b"Hello").await.unwrap();
//! });
//!
//! while let Some(bytes) = stream.next().await {
//! // ...
//! }
//! }
//! ```
//!
//! [AsyncRead]: https://docs.rs/futures/latest/futures/prelude/trait.AsyncRead.html
//! [AsyncWrite]: https://docs.rs/futures/latest/futures/prelude/trait.AsyncWrite.html
//! [Stream]: https://docs.rs/futures/latest/futures/prelude/trait.Stream.html
//! [Clone]: https://doc.rust-lang.org/std/clone/trait.Clone.html
//! [TcpStream]: https://docs.rs/async-std/latest/async_std/net/struct.TcpStream.html
//! [UnixStream]: https://docs.rs/async-std/latest/async_std/os/unix/net/struct.UnixStream.html
pub use *;
pub use *;