diff --git a/src/utils.rs b/src/utils.rs index 6439d2a..8a44b46 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -63,11 +63,15 @@ where /// ``` /// use image_api::utils::retry_with_backoff_if; /// -/// fn is_transient(e: &DbError) -> bool { /* ... */ } +/// fn is_transient(e: &std::io::Error) -> bool { +/// // Only retry connection-class failures; a NotFound is deterministic. +/// e.kind() == std::io::ErrorKind::ConnectionRefused +/// } /// /// let result = retry_with_backoff_if("some-write", 4, is_transient, || { -/// Ok::<_, anyhow::Error>(42) +/// Ok::(42) /// }); +/// assert!(result.is_ok_and(|v| v == 42)); /// ``` pub fn retry_with_backoff_if bool>( label: &str,