A simple crate that helps you to retry your Future
s and Stream
s in a neat
and simple way.
```rust extern crate futuresretry; // ... use futuresretry::{RetryPolicy, StreamRetryExt};
fn handleerror(e: io::Error) -> RetryPolicy
fn serve_connection(stream: TcpStream) -> impl Future fn main() {
let listener: TcpListener = // ...
let server = listener.incoming()
.retry(handleerror) // Magic happens here
.andthen(|stream| {
tokio::spawn(serveconnection(stream));
Ok(())
})
.foreach(|| Ok(()))
.maperr(|e| eprintln!("Caught an error {}", e));
tokio::run(server);
}
``` Licensed under either of at your option. Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
additional terms or conditions.License
Contribution