This module is the user-facing entrypoint for circuit breaker usage. The internal structures are available via other modules if required, but are (for now) mostly undocumented.
You should usually stick to this module for documentation and examples.
Note: The type aliases used by this public API require users to supply function pointers instead of closures. This is because the type of a closure can not currently be named and circuit breakers will often have to be stored in context structs and the like without propagating the closure trait constraints all the way up.
If you need to store closures or other types that implement the
Fn-trait, please take a look at the internal modules.
Use this function to construct a circuit breaker without a fallback function.
Use this function to construct a circuit breaker with a fallback function:
A Command is a runnable circuit breaker. It can be constructed either with or without a fallback method that can provide alternative values if the contained calls fail or if the breaker is open.
Convenience type alias for function pointers matching the input/output and error types of a circuit breaker.
Convenience type alias matching the fallback function pointer of a circuit breaker.