pub struct AsyncGuardAdapterBuilder<E>where
E: ExternalGuard + ?Sized,{ /* private fields */ }Expand description
Fluent builder for AsyncGuardAdapter.
Implementations§
Source§impl<E> AsyncGuardAdapterBuilder<E>where
E: ExternalGuard + ?Sized,
impl<E> AsyncGuardAdapterBuilder<E>where
E: ExternalGuard + ?Sized,
Sourcepub fn new(inner: Arc<E>) -> AsyncGuardAdapterBuilder<E>
pub fn new(inner: Arc<E>) -> AsyncGuardAdapterBuilder<E>
Start from the given guard and default configuration.
Sourcepub fn circuit(
self,
circuit: CircuitBreakerConfig,
) -> AsyncGuardAdapterBuilder<E>
pub fn circuit( self, circuit: CircuitBreakerConfig, ) -> AsyncGuardAdapterBuilder<E>
Override the circuit breaker configuration.
Sourcepub fn retry(self, retry: RetryConfig) -> AsyncGuardAdapterBuilder<E>
pub fn retry(self, retry: RetryConfig) -> AsyncGuardAdapterBuilder<E>
Override retry configuration.
Sourcepub fn cache_capacity(
self,
capacity: NonZero<usize>,
) -> AsyncGuardAdapterBuilder<E>
pub fn cache_capacity( self, capacity: NonZero<usize>, ) -> AsyncGuardAdapterBuilder<E>
Set the cache capacity (non-zero).
Sourcepub fn cache_ttl(self, ttl: Duration) -> AsyncGuardAdapterBuilder<E>
pub fn cache_ttl(self, ttl: Duration) -> AsyncGuardAdapterBuilder<E>
Set the cache TTL.
Sourcepub fn rate_limit(
self,
rate_per_second: f64,
burst: u32,
) -> AsyncGuardAdapterBuilder<E>
pub fn rate_limit( self, rate_per_second: f64, burst: u32, ) -> AsyncGuardAdapterBuilder<E>
Set the rate limiter (calls per second + burst).
Sourcepub fn circuit_open_verdict(
self,
verdict: CircuitOpenVerdict,
) -> AsyncGuardAdapterBuilder<E>
pub fn circuit_open_verdict( self, verdict: CircuitOpenVerdict, ) -> AsyncGuardAdapterBuilder<E>
Set the verdict returned while the breaker is open.
Sourcepub fn rate_limited_verdict(
self,
verdict: RateLimitedVerdict,
) -> AsyncGuardAdapterBuilder<E>
pub fn rate_limited_verdict( self, verdict: RateLimitedVerdict, ) -> AsyncGuardAdapterBuilder<E>
Set the verdict returned when the rate limiter rejects a call.
Sourcepub fn clock(self, clock: Arc<dyn Clock>) -> AsyncGuardAdapterBuilder<E>
pub fn clock(self, clock: Arc<dyn Clock>) -> AsyncGuardAdapterBuilder<E>
Override the time source. Primarily for tests.
Sourcepub fn build(self) -> AsyncGuardAdapter<E>
pub fn build(self) -> AsyncGuardAdapter<E>
Finalize the builder.
Auto Trait Implementations§
impl<E> Freeze for AsyncGuardAdapterBuilder<E>where
E: ?Sized,
impl<E> !RefUnwindSafe for AsyncGuardAdapterBuilder<E>
impl<E> Send for AsyncGuardAdapterBuilder<E>where
E: ?Sized,
impl<E> Sync for AsyncGuardAdapterBuilder<E>where
E: ?Sized,
impl<E> Unpin for AsyncGuardAdapterBuilder<E>where
E: ?Sized,
impl<E> UnsafeUnpin for AsyncGuardAdapterBuilder<E>where
E: ?Sized,
impl<E> !UnwindSafe for AsyncGuardAdapterBuilder<E>
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