Added to_str for Status
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use std::fmt;
|
||||
|
||||
#[repr(u8)]
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub enum Status {
|
||||
Input = 10,
|
||||
Success = 20,
|
||||
@@ -26,6 +26,35 @@ pub enum Status {
|
||||
ExpiredCertificateRejected = 65,
|
||||
}
|
||||
|
||||
impl Status {
|
||||
pub fn to_str(&self) -> &str {
|
||||
let meta = match self {
|
||||
Status::Input => "Input",
|
||||
Status::Success => "Success",
|
||||
Status::SuccessEndOfSession => "Success End Of Session",
|
||||
Status::RedirectTemporary => "Redirect Temporary",
|
||||
Status::RedirectPermanent => "Redirect Permanent",
|
||||
Status::TemporaryFailure => "Temporary Failure",
|
||||
Status::ServerUnavailable => "Server Unavailable",
|
||||
Status::CGIError => "CGI Error!",
|
||||
Status::ProxyError => "Proxy Error!",
|
||||
Status::SlowDown => "Slow Down!",
|
||||
Status::PermanentFailure => "Permanent Failure",
|
||||
Status::NotFound => "Not Found!",
|
||||
Status::Gone => "Gone!",
|
||||
Status::ProxyRequestRefused => "Proxy Requet Refused",
|
||||
Status::BadRequest => "Bad Request!",
|
||||
Status::ClientCertificateRequired => "Client Certificate Required",
|
||||
Status::TransientCertificateRequested => "Transient Certificate Requested",
|
||||
Status::AuthorisedCertificateRequired => "Authorised Certificate Required",
|
||||
Status::CertificateNotAccepted => "Certificate Not Accepted",
|
||||
Status::FutureCertificateRejected => "Future Certificate Rejected",
|
||||
Status::ExpiredCertificateRejected => "Expired Certificate Rejected",
|
||||
};
|
||||
return meta
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Status {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{:?}", self)
|
||||
|
||||
Reference in New Issue
Block a user