#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum ResponseSeverity {
#[default]
Unspecified,
Informational,
Success,
Redirection,
ClientError,
ServerError,
}
impl ResponseSeverity {
pub fn as_str(self) -> &'static str {
match self {
Self::Unspecified => "unspecified",
Self::Informational => "informational",
Self::Success => "success",
Self::Redirection => "redirection",
Self::ClientError => "client_error",
Self::ServerError => "server_error",
}
}
pub fn parse_str(s: &str) -> Self {
match s {
"informational" => Self::Informational,
"success" => Self::Success,
"redirection" => Self::Redirection,
"client_error" => Self::ClientError,
"server_error" => Self::ServerError,
_ => Self::Unspecified,
}
}
}