mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-24 01:54:19 +00:00
rename enum item
This commit is contained in:
parent
8f55c2c362
commit
a782288671
@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user