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() }
|
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 {
|
pub fn failure_redirect_limit(count: usize, is_global: bool) -> Self {
|
||||||
Self::Failure {
|
Self::Failure {
|
||||||
event: now(),
|
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`
|
/// Local `Failure` status for `Client`
|
||||||
pub enum Failure {
|
pub enum Failure {
|
||||||
/// Redirection count limit reached by protocol driver or global settings
|
/// Redirection count limit reached by protocol driver or global settings
|
||||||
RedirectLimit { count: usize, is_global: bool },
|
RedirectCount { count: usize, is_global: bool },
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Failure {
|
impl Failure {
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
/// Create new `Self::RedirectLimit`
|
/// Create new `Self::RedirectCount`
|
||||||
pub fn redirect_limit(count: usize, is_global: bool) -> Self {
|
pub fn redirect_count(count: usize, is_global: bool) -> Self {
|
||||||
Self::RedirectLimit { count, is_global }
|
Self::RedirectCount { count, is_global }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Failure {
|
impl Display for Failure {
|
||||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||||
match self {
|
match self {
|
||||||
Self::RedirectLimit { count, is_global } => {
|
Self::RedirectCount { count, is_global } => {
|
||||||
if *is_global {
|
if *is_global {
|
||||||
write!(f, "Redirection limit ({count}) reached by global settings")
|
write!(f, "Redirection limit ({count}) reached by global settings")
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user