pub trait CircuitBreaker {
    fn is_call_permitted(&self) -> bool;
    fn call_with<P, F, E, R>(&self, predicate: P, f: F) -> Result<R, Error<E>>
    where
        P: FailurePredicate<E>,
        F: FnOnce() -> Result<R, E>
; fn call<F, E, R>(&self, f: F) -> Result<R, Error<E>>
    where
        F: FnOnce() -> Result<R, E>
, { ... } }
Expand description

A circuit breaker’s public interface.

Required Methods

Requests permission to call.

It returns true if a call is allowed, or false if prohibited.

Executes a given function within circuit breaker.

Depending on function result value, the call will be recorded as success or failure. It checks error by the provided predicate. If the predicate returns true for the error, the call is recorded as failure otherwise considered this error as a success.

Provided Methods

Executes a given function within circuit breaker.

Depending on function result value, the call will be recorded as success or failure.

Implementors