Enum stripe::RequestStrategy
source · [−]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
sourceimpl RequestStrategy
impl RequestStrategy
pub fn test(
&self,
status: Option<StatusCode>,
stripe_should_retry: Option<bool>,
retry_count: u32
) -> Outcome
sourcepub fn idempotent_with_uuid() -> Self
pub fn idempotent_with_uuid() -> Self
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<_>>()
);
}
pub fn get_key(&self) -> Option<String>
Trait Implementations
sourceimpl Clone for RequestStrategy
impl Clone for RequestStrategy
sourcefn clone(&self) -> RequestStrategy
fn clone(&self) -> RequestStrategy
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for RequestStrategy
impl Send for RequestStrategy
impl Sync for RequestStrategy
impl Unpin for RequestStrategy
impl UnwindSafe for RequestStrategy
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more