Skip to main content

BackoffLimit

Struct BackoffLimit 

Source
pub struct BackoffLimit<S, const LIMIT: usize> { /* private fields */ }
Expand description

Wraps a BackoffStrategy to make it a BoundedBackoffStrategy completing after LIMIT iterations.

Implementations§

Source§

impl<S: BackoffStrategy, const LIMIT: usize> BackoffLimit<S, LIMIT>

Source

pub fn new(strategy: S) -> Self

Wraps the given strategy.

Trait Implementations§

Source§

impl<S: BackoffStrategy, const LIMIT: usize> BackoffStrategy for BackoffLimit<S, LIMIT>

Source§

const BACKOFF: bool = S::BACKOFF

Whether the strategy does backoff or not. Read more
Source§

fn backoff(&mut self) -> RetryStrategy

Performs backoff and returns how the CAS should be retried. Read more
Source§

fn will_reload(&self) -> bool

Returns true if the next call to backoff will not return RetryStrategy::NoReload. Read more
Source§

fn backoff_reload<T: PartialEq, F: FnMut() -> T>( &mut self, current: T, reload: F, ) -> T

Performs backoff after a failed CAS and reloads the atomic value according to the returned RetryStrategy. Read more
Source§

fn backoff_until<C: BackoffUntilCondition, F: FnMut() -> C>( &mut self, f: F, ) -> C::Result

Loops until a condition is satisfied, performing backoff at each iteration.
Source§

impl<S: BackoffStrategy, const LIMIT: usize> BoundedBackoffStrategy for BackoffLimit<S, LIMIT>

Source§

fn is_completed(&self) -> bool

Returns true if the bounded number of iterations has been reached. Read more
Source§

fn try_backoff_until<C: BackoffUntilCondition, F: FnMut() -> C>( &mut self, f: F, ) -> Option<C::Result>

Loops until a condition is satisfied or the backoff is completed, performing backoff at each iteration. Read more
Source§

impl<S: Debug, const LIMIT: usize> Debug for BackoffLimit<S, LIMIT>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: Default, const LIMIT: usize> Default for BackoffLimit<S, LIMIT>

Source§

fn default() -> BackoffLimit<S, LIMIT>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S, const LIMIT: usize> Freeze for BackoffLimit<S, LIMIT>
where S: Freeze,

§

impl<S, const LIMIT: usize> RefUnwindSafe for BackoffLimit<S, LIMIT>
where S: RefUnwindSafe,

§

impl<S, const LIMIT: usize> Send for BackoffLimit<S, LIMIT>
where S: Send,

§

impl<S, const LIMIT: usize> Sync for BackoffLimit<S, LIMIT>
where S: Sync,

§

impl<S, const LIMIT: usize> Unpin for BackoffLimit<S, LIMIT>
where S: Unpin,

§

impl<S, const LIMIT: usize> UnsafeUnpin for BackoffLimit<S, LIMIT>
where S: UnsafeUnpin,

§

impl<S, const LIMIT: usize> UnwindSafe for BackoffLimit<S, LIMIT>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.