Added send function

This commit is contained in:
int 80h
2020-04-22 20:15:23 -04:00
parent a3d3cc7214
commit ac75542dc6
4 changed files with 114 additions and 32 deletions

44
src/status.rs Normal file
View File

@@ -0,0 +1,44 @@
use std::fmt;
#[repr(u8)]
#[derive(Debug)]
pub enum Status {
Input = 10,
Success = 20,
SuccessEndOfSession = 21,
RedirectTemporary = 30,
RedirectPermanent = 31,
TemporaryFailure = 40,
ServerUnavailable = 41,
CGIError = 42,
ProxyError = 43,
SlowDown = 44,
PermanentFailure = 50,
NotFound = 51,
Gone = 52,
ProxyRequestRefused = 53,
BadRequest = 59,
ClientCertificateRequired = 60,
TransientCertificateRequested = 61,
AuthorisedCertificateRequired = 62,
CertificateNotAccepted = 63,
FutureCertificateRejected = 64,
ExpiredCertificateRejected = 65,
}
impl fmt::Display for Status {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?}", self)
// or, alternatively:
// fmt::Debug::fmt(self, f)
}
}
impl Status {
pub fn as_str(&self) -> &'static str {
match *self {
Status::Success => "20\t",
_ => "",
}
}
}