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