qubit_http/error/retry_hint.rs
1/*******************************************************************************
2 *
3 * Copyright (c) 2025 - 2026.
4 * Haixing Hu, Qubit Co. Ltd.
5 *
6 * All rights reserved.
7 *
8 ******************************************************************************/
9//! # Retry Hint
10//!
11//! Provides lightweight retryability classification for HTTP errors.
12//!
13//! # Author
14//!
15//! Haixing Hu
16
17use parse_display::{Display, FromStr as DeriveFromStr};
18use serde::{Deserialize, Serialize};
19
20/// High-level classification from [`crate::HttpError::retry_hint`] for backoff policies.
21#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Display, DeriveFromStr)]
22#[serde(rename_all = "snake_case")]
23#[display(style = "snake_case")]
24pub enum RetryHint {
25 /// Transient failure (timeouts, some 5xx/429, transport); callers may retry with care.
26 Retryable,
27 /// Permanent or non-idempotent failure; do not retry by default.
28 NonRetryable,
29}