Macro pravega_client_retry::wrap_with_async_retry[][src]

macro_rules! wrap_with_async_retry {
    ($retrypolicy:expr, $expression:expr) => { ... };
}

wrap_with_async_retry! macro wraps any arbitrary async function with pravega_rust_client_retry::retry_async::retry_async This macro takes two parameters. The first parameter is the Retry policy which implements trait BackoffSchedule. The second parameter is the async function that needs to be wrapped within the retry logic. The function invocation will be retried only error returned by the function returns can_retry() as true.

E.g: usage

use pravega_rust_client_retry::retry_policy::RetryWithBackoff;
use pravega_rust_client_retry::retry_async::retry_async;
use pravega_rust_client_retry::wrap_with_async_retry;
//CustomError implements Retrayable trait
async fn function_a(param1: &str, param2:u8) -> Result<(), CustomError> {

}
let retry_policy = RetryWithBackoff::default().max_tries(10);
// the below invocation wraps function_a with the retry logic.
wrap_with_async_retry!(retry_policy, function_a("test", 1));