#[non_exhaustive]pub struct RetryBudget {
pub ratio: f64,
pub min_per_sec: f64,
pub reserve: f64,
}Expand description
How many retries a client may make, as a fraction of the calls it makes.
RetryBudget::new(0.1, 1.0) allows one retry for every ten calls, and one
a second besides, so that a client that makes a call a minute can still
retry it. Up to reserve retries are saved up for a burst
of failures.
#[non_exhaustive]: build it with new and
with_reserve.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.ratio: f64Retries earned by each call. 0.1 is one retry per ten calls.
min_per_sec: f64Retries earned per second, whatever the calls, so that a client that makes few can still retry them.
reserve: f64The most retries that can be saved up, and the number a new client
starts with: the size of the burst it can make before the rate above
is all there is. At least 1.0, since less could never pay for one.
Implementations§
Source§impl RetryBudget
impl RetryBudget
Sourcepub const fn new(ratio: f64, min_per_sec: f64) -> RetryBudget
pub const fn new(ratio: f64, min_per_sec: f64) -> RetryBudget
A budget earning ratio retries per call and min_per_sec per second,
with a reserve of 10. A rate that is negative,
infinite or not a number earns nothing.
Sourcepub const fn with_reserve(self, reserve: f64) -> RetryBudget
pub const fn with_reserve(self, reserve: f64) -> RetryBudget
Sets the most retries that can be saved up. Less than 1.0, or not a
number, becomes 1.0: a retry costs one.
Trait Implementations§
Source§impl Clone for RetryBudget
impl Clone for RetryBudget
Source§fn clone(&self) -> RetryBudget
fn clone(&self) -> RetryBudget
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RetryBudget
Source§impl Debug for RetryBudget
impl Debug for RetryBudget
Source§impl PartialEq for RetryBudget
impl PartialEq for RetryBudget
impl StructuralPartialEq for RetryBudget
Auto Trait Implementations§
impl Forget for RetryBudget
impl Freeze for RetryBudget
impl Move for RetryBudget
impl RefUnwindSafe for RetryBudget
impl Send for RetryBudget
impl Sync for RetryBudget
impl Unpin for RetryBudget
impl UnsafeUnpin for RetryBudget
impl UnwindSafe for RetryBudget
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].