Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonqn committed Oct 5, 2021
1 parent e212a69 commit 8822b4c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[package]
name = "fure"
version = "0.4.0"
version = "0.4.1"
edition = "2018"
authors = ["Ilya Titkov <[email protected]>"]
keywords = ["futures-retry", "retry", "futures"]
license = "MIT"
license-file = "LICENSE"
description = "Retrying futures using different policies"
categories = ["asynchronous"]
readme = "README.md"
Expand All @@ -22,4 +23,8 @@ tokio = { version = "1", features = [ "time", "rt" ], default-features = false }
reqwest = "0.11"

[features]
default = [ "tokio", "rand" ]
default = [ "tokio", "rand" ]

[badges]
github = { repository = "Leonqn/fure", workflow = "CI" }
crates = { image = "", url = ""}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[![Crates.io](https://img.shields.io/crates/v/fure.svg)](https://crates.io/crates/fure)
[![Docs.rs](https://img.shields.io/docsrs/fure.svg)](https://docs.rs/fure)
[![Workflow Status](https://github.com/Leonqn/fure/workflows/CI/badge.svg)](https://github.com/Leonqn/fure/actions?query=workflow%3A%22CI%22)

# fure

A crate for retrying futures.
Expand All @@ -17,8 +21,6 @@ If the timer completes first (it means that the request didn't complete in 1 sec
If the request completes first and it has an [`Ok`] response it is returned, if request has an [`Err`] response, timer resets and a new request fires.

At most 4 requests will be fired.

When one of runninng requests completes with an [`Ok`] result it will be returned.
```rust
use fure::policies::{interval, attempts};
use std::time::Duration;
Expand Down
9 changes: 9 additions & 0 deletions README.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[![Crates.io](https://img.shields.io/crates/v/fure.svg)](https://crates.io/crates/fure)
[![Docs.rs](https://img.shields.io/docsrs/fure.svg)](https://docs.rs/fure)
{{badges}}

# {{crate}}

{{readme}}

License: {{license}}
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
//! If the request completes first and it has an [`Ok`] response it is returned, if request has an [`Err`] response, timer resets and a new request fires.
//!
//! At most 4 requests will be fired.
//!
//! When one of runninng requests completes with an [`Ok`] result it will be returned.
//! ```
//! # async fn run() -> Result<(), reqwest::Error> {
//! use fure::policies::{interval, attempts};
Expand Down Expand Up @@ -128,12 +126,14 @@ pub trait Policy<T, E>: Sized {
/// Future type returned by [`Policy::retry`].
type RetryFuture: Future<Output = Self>;

/// When completes a [`Policy::retry`] will be called with [`None`] argument.
/// This method is called right after calling your future and
/// if it completes before your future [`Policy::retry`] will be called with [`None`] argument
/// without cancelling your future.
///
/// All previous futures won't be cancelled.
/// If your future completes first, current [`Self::ForceRetryFuture`] will be dropped and this method will be called again if needs.
fn force_retry_after(&self) -> Self::ForceRetryFuture;

/// Checks the policy if a new futures should be created and polled using [`CreateFuture`].
/// Checks the policy if a new future should be created and polled using [`CreateFuture`].
///
/// If the future should be created return [`Some`] with a new policy, otherwise return [`None`].
///
Expand Down

0 comments on commit 8822b4c

Please sign in to comment.