3个版本
0.1.2 | 2020年5月6日 |
---|---|
0.1.1 | 2020年5月6日 |
0.1.0 | 2020年5月6日 |
#1277 in 异步
每月23次下载
9KB
138 行
Futures MockStream
Futures crate的MockStream异步{Read, Write}和Stream特质
安装
从crates.io安装
[dependencies]
futures-mockstream = "0.1"
示例
使用smol
use futures-mockStream::MockStream;
use smol;
#[cfg(test)]
mod tests {
#[test]
fn async_read() {
smol::run(async {
let mut mockstream = MockStream::from(&b"GET /index HTTP/1.1\r\n");
while let Some(resp) = MyConn::with_stream(mockstream).next().await {
match resp {
Ok(r) => { // your asserts },
Err(e) => {},
}
}
})
}
}
依赖
~64KB