pub struct CircuitBreakerConfig {
pub failure_threshold: usize,
pub success_threshold: usize,
pub reset_timeout: Duration,
pub half_open_max_requests: usize,
}Expand description
Configuration for the circuit breaker.
Fields§
§failure_threshold: usizeNumber of failures before opening the circuit.
success_threshold: usizeNumber of successes in half-open state before closing.
reset_timeout: DurationDuration to wait before transitioning from open to half-open.
half_open_max_requests: usizeMaximum number of requests allowed in half-open state.
Implementations§
Source§impl CircuitBreakerConfig
impl CircuitBreakerConfig
Sourcepub fn with_failure_threshold(self, threshold: usize) -> Self
pub fn with_failure_threshold(self, threshold: usize) -> Self
Set the failure threshold.
Sourcepub fn with_success_threshold(self, threshold: usize) -> Self
pub fn with_success_threshold(self, threshold: usize) -> Self
Set the success threshold for recovery.
Sourcepub fn with_reset_timeout(self, timeout: Duration) -> Self
pub fn with_reset_timeout(self, timeout: Duration) -> Self
Set the reset timeout.
Sourcepub fn with_half_open_max_requests(self, max: usize) -> Self
pub fn with_half_open_max_requests(self, max: usize) -> Self
Set the maximum half-open requests.
Trait Implementations§
Source§impl Clone for CircuitBreakerConfig
impl Clone for CircuitBreakerConfig
Source§fn clone(&self) -> CircuitBreakerConfig
fn clone(&self) -> CircuitBreakerConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CircuitBreakerConfig
impl Debug for CircuitBreakerConfig
Auto Trait Implementations§
impl Freeze for CircuitBreakerConfig
impl RefUnwindSafe for CircuitBreakerConfig
impl Send for CircuitBreakerConfig
impl Sync for CircuitBreakerConfig
impl Unpin for CircuitBreakerConfig
impl UnwindSafe for CircuitBreakerConfig
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request