[−][src]Struct recloser::Recloser
A concurrent cirbuit breaker based on RingBuffer
s that allows or rejects
calls depending on the state it is in.
Implementations
impl Recloser
[src]
pub fn custom() -> RecloserBuilder
[src]
Returns a builder to create a customized Recloser
.
pub fn call<F, T, E>(&self, f: F) -> Result<T, Error<E>> where
F: FnOnce() -> Result<T, E>,
[src]
F: FnOnce() -> Result<T, E>,
Wraps a function that may fail, records the result as success or failure.
Uses default AnyError
predicate that considers any Err(_)
as a failure.
Based on the result, state transition may happen.
pub fn call_with<P, F, T, E>(&self, predicate: P, f: F) -> Result<T, Error<E>> where
P: ErrorPredicate<E>,
F: FnOnce() -> Result<T, E>,
[src]
P: ErrorPredicate<E>,
F: FnOnce() -> Result<T, E>,
Wraps a function that may fail, the custom predicate
will be used to
determine whether the result was a success or failure.
Based on the result, state transition may happen.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Recloser
impl Send for Recloser
impl Sync for Recloser
impl Unpin for Recloser
impl UnwindSafe for Recloser
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,