Skip to main content

RetryResult

Struct RetryResult 

Source
pub struct RetryResult<T, E> {
    pub result: Result<T, E>,
    pub attempts: usize,
    pub total_time: Duration,
}
Available on crate feature retry only.
Expand description

Result of a retry operation.

Fields§

§result: Result<T, E>

The final result.

§attempts: usize

Number of attempts made.

§total_time: Duration

Total time spent (including delays).

Implementations§

Source§

impl<T, E> RetryResult<T, E>

Source

pub const fn is_ok(&self) -> bool

Check if the operation succeeded.

Source

pub const fn is_err(&self) -> bool

Check if the operation failed.

Source

pub fn unwrap(self) -> T
where E: Debug,

Unwrap the result, panicking on error.

§Panics

Panics if the result is an error.

Source

pub fn into_result(self) -> Result<T, E>

Get the result, converting error.

§Errors

Returns the last error if all retry attempts failed.

Trait Implementations§

Source§

impl<T: Debug, E: Debug> Debug for RetryResult<T, E>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, E> Freeze for RetryResult<T, E>
where T: Freeze, E: Freeze,

§

impl<T, E> RefUnwindSafe for RetryResult<T, E>

§

impl<T, E> Send for RetryResult<T, E>
where T: Send, E: Send,

§

impl<T, E> Sync for RetryResult<T, E>
where T: Sync, E: Sync,

§

impl<T, E> Unpin for RetryResult<T, E>
where T: Unpin, E: Unpin,

§

impl<T, E> UnsafeUnpin for RetryResult<T, E>
where T: UnsafeUnpin, E: UnsafeUnpin,

§

impl<T, E> UnwindSafe for RetryResult<T, E>
where T: UnwindSafe, E: 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.