pub struct ExecutionPolicy<C, T, E> { /* private fields */ }Expand description
A reusable reliability policy. Cheap to clone (shares a compiled Plan).
Implementations§
Source§impl ExecutionPolicy<(), (), ()>
impl ExecutionPolicy<(), (), ()>
Sourcepub fn builder<T, E>() -> ExecutionPolicyBuilder<T, E>
pub fn builder<T, E>() -> ExecutionPolicyBuilder<T, E>
Start configuring a policy. The T/E types are inferred at the first
retry(..) or execute call site.
Source§impl<C, T, E> ExecutionPolicy<C, T, E>
impl<C, T, E> ExecutionPolicy<C, T, E>
Sourcepub fn circuit_state(&self) -> Option<BreakerState>
pub fn circuit_state(&self) -> Option<BreakerState>
Current circuit-breaker state, or None if no breaker is configured.
Source§impl<C, T, E> ExecutionPolicy<C, T, E>where
C: Core,
impl<C, T, E> ExecutionPolicy<C, T, E>where
C: Core,
Sourcepub async fn run<F>(&self, op: F) -> Result<T, ExecutionError<E>>where
F: AsyncFnMut() -> Result<T, E>,
pub async fn run<F>(&self, op: F) -> Result<T, ExecutionError<E>>where
F: AsyncFnMut() -> Result<T, E>,
Run an operation that needs neither application state nor attempt metadata.
Sourcepub async fn execute<F>(&self, op: F) -> Result<T, ExecutionError<E>>
pub async fn execute<F>(&self, op: F) -> Result<T, ExecutionError<E>>
Run an operation that wants attempt metadata.
Sourcepub async fn run_with<S, F>(
&self,
state: &S,
op: F,
) -> Result<T, ExecutionError<E>>
pub async fn run_with<S, F>( &self, state: &S, op: F, ) -> Result<T, ExecutionError<E>>
Run an operation with injected application state.
Sourcepub async fn execute_with<S, F>(
&self,
state: &S,
op: F,
) -> Result<T, ExecutionError<E>>
pub async fn execute_with<S, F>( &self, state: &S, op: F, ) -> Result<T, ExecutionError<E>>
Run an operation with injected state and attempt metadata.
Trait Implementations§
Source§impl<C: Clone, T, E> Clone for ExecutionPolicy<C, T, E>
impl<C: Clone, T, E> Clone for ExecutionPolicy<C, T, E>
Auto Trait Implementations§
impl<C, T, E> !RefUnwindSafe for ExecutionPolicy<C, T, E>
impl<C, T, E> !UnwindSafe for ExecutionPolicy<C, T, E>
impl<C, T, E> Freeze for ExecutionPolicy<C, T, E>where
C: Freeze,
impl<C, T, E> Send for ExecutionPolicy<C, T, E>where
C: Send,
impl<C, T, E> Sync for ExecutionPolicy<C, T, E>where
C: Sync,
impl<C, T, E> Unpin for ExecutionPolicy<C, T, E>where
C: Unpin,
impl<C, T, E> UnsafeUnpin for ExecutionPolicy<C, T, E>where
C: UnsafeUnpin,
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