futures-mockstream

Crates.iofutures-mockstream
lib.rsfutures-mockstream
version0.1.2
sourcesrc
created_at2020-05-06 09:28:42.091115
updated_at2020-05-06 09:48:35.062093
descriptionMinimal mockstream which implements futures async traits
homepagehttps://github.com/alex179ohm/futures-mockstream
repositoryhttps://github.com/alex179ohm/futures-mockstream
max_upload_size
id238123
size11,900
Alessandro Cresto Miseroglio (alex179ohm)

documentation

README

Futures MockStream

MockStream for futures crate Async{Read, Write} and Stream traits

Tests status docs.rs docs

Install

Install from crates.io

[dependencies]
futures-mockstream = "0.1"

Example

with 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) => {},
                }
            }
        })
    }
}
Commit count: 42

cargo fmt