Skip to main content

Crate qubit_retry

Crate qubit_retry 

Source
Expand description

Type-preserving retry policy for synchronous and asynchronous operations.

Retry<E> binds only the operation error type. The success type T is introduced on run / run_async, so normal error retry does not require T: Clone + Eq + Hash.

The default error type is BoxError from the qubit-error crate. It is not re-exported by this crate; callers that need the boxed error alias should import it from qubit-error directly.

The public workflow is intentionally small:

  1. Build a Retry policy with Retry::builder or Retry::from_options.
  2. Choose the execution mode:
    • Retry::run for low-overhead same-thread synchronous work.
    • Retry::run_async for Tokio futures and async timeouts when the tokio feature is enabled.
    • Retry::run_in_worker for blocking work that needs panic capture, timeout waiting, or cooperative cancellation.
  3. Inspect RetryError when the flow stops. It keeps the terminal reason, the last observed AttemptFailure, and the final RetryContext.

Internally, Retry stays a facade. Options, event dispatch, flow state, failure policy, and execution loops live in separate objects so each piece owns one retry concern.

Re-exports§

pub use error::AttemptExecutorError;
pub use error::AttemptFailure;
pub use error::AttemptPanic;
pub use error::RetryConfigError;
pub use error::RetryError;
pub use error::RetryErrorReason;
pub use error::RetryResult;
pub use event::AttemptFailureDecision;
pub use event::AttemptFailureListener;
pub use event::AttemptSuccessListener;
pub use event::AttemptTimeoutSource;
pub use event::BeforeAttemptListener;
pub use event::RetryAfterHint;
pub use event::RetryContext;
pub use event::RetryErrorListener;
pub use event::RetryScheduledListener;
pub use executor::AttemptCancelToken;
pub use executor::Retry;
pub use executor::RetryBuilder;
pub use options::RetryConfigValues;
pub use options::AttemptTimeoutOption;
pub use options::AttemptTimeoutPolicy;
pub use options::ParseRetryJitterError;
pub use options::RetryDelay;
pub use options::RetryJitter;
pub use options::RetryOptions;

Modules§

constants
Configuration keys and built-in defaults for retry options.
error
Error types used by retry executors.
event
Retry event types and listener aliases.
executor
Retry executor and builder modules and public re-exports.
options
Retry option modules and public re-exports.