pub enum RequestStrategy {
    Once,
    Idempotent(String),
    Retry(u32),
    ExponentialBackoff(u32),
}

Variants

Once

Idempotent(String)

Run it once with a given idempotency key.

Retry(u32)

This strategy will retry the request up to the specified number of times using the same, random, idempotency key, up to n times.

ExponentialBackoff(u32)

This strategy will retry the request up to the specified number of times using the same, random, idempotency key with exponential backoff, up to n times.

Implementations

Examples found in repository?
examples/strategy.rs (line 15)
13
14
15
16
17
18
19
20
21
22
23
24
25
26
async fn main() {
    let secret_key = std::env::var("STRIPE_SECRET_KEY").expect("Missing STRIPE_SECRET_KEY in env");
    let client = Client::new(secret_key).with_strategy(RequestStrategy::idempotent_with_uuid());

    let first_page =
        Customer::list(&client, &ListCustomers { limit: Some(1), ..Default::default() })
            .await
            .unwrap();

    println!(
        "first page of customers: {:#?}",
        first_page.data.iter().map(|c| c.name.as_ref().unwrap()).collect::<Vec<_>>()
    );
}

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more