rename enum item

This commit is contained in:
yggverse 2025-01-15 08:47:54 +02:00
parent 8f55c2c362
commit a782288671
2 changed files with 7 additions and 7 deletions

View File

@ -33,11 +33,11 @@ impl Status {
Self::Cancelled { event: now() }
}
/// Create new `Self::Failure` as `Failure::RedirectLimit`
/// Create new `Self::Failure` as `Failure::RedirectCount`
pub fn failure_redirect_limit(count: usize, is_global: bool) -> Self {
Self::Failure {
event: now(),
failure: Failure::redirect_limit(count, is_global),
failure: Failure::redirect_count(count, is_global),
}
}

View File

@ -4,22 +4,22 @@ use std::fmt::{Display, Formatter, Result};
/// Local `Failure` status for `Client`
pub enum Failure {
/// Redirection count limit reached by protocol driver or global settings
RedirectLimit { count: usize, is_global: bool },
RedirectCount { count: usize, is_global: bool },
}
impl Failure {
// Constructors
/// Create new `Self::RedirectLimit`
pub fn redirect_limit(count: usize, is_global: bool) -> Self {
Self::RedirectLimit { count, is_global }
/// Create new `Self::RedirectCount`
pub fn redirect_count(count: usize, is_global: bool) -> Self {
Self::RedirectCount { count, is_global }
}
}
impl Display for Failure {
fn fmt(&self, f: &mut Formatter) -> Result {
match self {
Self::RedirectLimit { count, is_global } => {
Self::RedirectCount { count, is_global } => {
if *is_global {
write!(f, "Redirection limit ({count}) reached by global settings")
} else {