

# 小的模式

小而有用的模式集合。

## 流的分割

`async-std` 未提供 `io` 句柄的 `split()` 方法。取而代之的是，将流分割为读、写两部分，如下所示：

```rust,edition2018
# extern crate async_std;
use async_std::{io, net::TcpStream};
async fn echo(stream: TcpStream) {
    let (reader, writer) = &mut (&stream, &stream);
    io::copy(reader, writer).await;
}
```
