pub struct CircuitBreaker { /* private fields */ }Expand description
A time-based circuit breaker. Cheap, lock-free, shareable.
Implementations§
Source§impl CircuitBreaker
impl CircuitBreaker
Sourcepub fn new(open_duration: Duration) -> Self
pub fn new(open_duration: Duration) -> Self
Creates a breaker that opens for open_duration after a failure.
Duration::ZERO disables it (it stays permanently closed).
Sourcepub fn is_disabled(&self) -> bool
pub fn is_disabled(&self) -> bool
true if this breaker is disabled (zero open-duration).
Sourcepub fn is_closed(&self, now: Timestamp) -> bool
pub fn is_closed(&self, now: Timestamp) -> bool
true if the breaker is closed (operations may proceed) at now.
If the open window has elapsed, the breaker auto-closes as a side effect.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CircuitBreaker
impl RefUnwindSafe for CircuitBreaker
impl Send for CircuitBreaker
impl Sync for CircuitBreaker
impl Unpin for CircuitBreaker
impl UnsafeUnpin for CircuitBreaker
impl UnwindSafe for CircuitBreaker
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