pub enum MsgCode {
Show 37 variants
Empty = 0,
MethodGet = 1,
MethodPost = 2,
MethodPut = 3,
MethodDelete = 4,
MethodFetch = 5,
MethodPatch = 6,
MethodIPatch = 7,
SuccessCreated = 65,
SuccessDeleted = 66,
SuccessValid = 67,
SuccessChanged = 68,
SuccessContent = 69,
SuccessContinue = 95,
ClientErrorBadRequest = 128,
ClientErrorUnauthorized = 129,
ClientErrorBadOption = 130,
ClientErrorForbidden = 131,
ClientErrorNotFound = 132,
ClientErrorMethodNotAllowed = 133,
ClientErrorNotAcceptable = 134,
ClientErrorRequestEntityIncomplete = 136,
ClientErrorPreconditionFailed = 140,
ClientErrorRequestEntityTooLarge = 141,
ClientErrorUnsupportedMediaType = 143,
ClientErrorTooManyRequests = 157,
ServerErrorInternalServerError = 160,
ServerErrorNotImplemented = 161,
ServerErrorBadGateway = 162,
ServerErrorServiceUnavailable = 163,
ServerErrorGatewayTimeout = 164,
ServerErrorProxyingNotSupported = 165,
SignalCsm = 225,
SignalPing = 226,
SignalPong = 227,
SignalRelease = 228,
SignalAbort = 229,
}
Expand description
Enum representing a CoAP message code.
Variants§
Empty = 0
Empty message code. Only used for ping requests, resets, and empty acknowledgements.
MethodGet = 1
CoAP GET method.
MethodPost = 2
CoAP POST method.
MethodPut = 3
CoAP PUT method.
MethodDelete = 4
CoAP DELETE method.
MethodFetch = 5
CoAP FETCH method.
MethodPatch = 6
CoAP PATCH method.
MethodIPatch = 7
CoAP iPATCH method.
SuccessCreated = 65
CoAP CREATED success code.
SuccessDeleted = 66
CoAP DELETED success code.
SuccessValid = 67
CoAP VALID success code.
SuccessChanged = 68
CoAP CHANGED success code.
SuccessContent = 69
CoAP CONTENT success code.
SuccessContinue = 95
CoAP CONTINUE success code.
ClientErrorBadRequest = 128
CoAP BAD_REQUEST client error.
CoAP UNAUTHORIZED client error.
ClientErrorBadOption = 130
CoAP BAD_OPTION client error.
ClientErrorForbidden = 131
CoAP FORBIDDEN client error.
ClientErrorNotFound = 132
CoAP NOT_FOUND client error.
ClientErrorMethodNotAllowed = 133
CoAP METHOD_NOT_ALLOWED client error.
ClientErrorNotAcceptable = 134
CoAP NOT_ACCEPTABLE client error.
ClientErrorRequestEntityIncomplete = 136
CoAP REQUEST_ENTITY_INCOMPLETE client error.
ClientErrorPreconditionFailed = 140
CoAP PRECONDITION_FAILED client error.
ClientErrorRequestEntityTooLarge = 141
CoAP REQUEST_ENTITY_TOO_LARGE client error.
ClientErrorUnsupportedMediaType = 143
CoAP UNSUPPORTED_MEDIA_TYPE client error.
ClientErrorTooManyRequests = 157
RFC8516 “Too Many Requests” Response Code for the Constrained Application Protocol
ServerErrorInternalServerError = 160
CoAP INTERNAL_SERVER_ERROR server error.
ServerErrorNotImplemented = 161
CoAP NOT_IMPLEMENTED server error.
ServerErrorBadGateway = 162
CoAP BAD_GATEWAY server error.
CoAP SERVICE_UNAVAILABLE server error.
ServerErrorGatewayTimeout = 164
CoAP GATEWAY_TIMEOUT server error.
ServerErrorProxyingNotSupported = 165
CoAP PROXYING_NOT_SUPPORTED server error.
SignalCsm = 225
CoAP CSM in-band signal.
SignalPing = 226
CoAP PING in-band signal.
SignalPong = 227
CoAP PONG in-band signal.
SignalRelease = 228
CoAP RELEASE in-band signal.
SignalAbort = 229
CoAP ABORT in-band signal.
Implementations§
Source§impl MsgCode
impl MsgCode
Sourcepub fn try_from(x: u8) -> Option<MsgCode>
pub fn try_from(x: u8) -> Option<MsgCode>
Tries to convert the given u8
into a MsgCode
. If the given code isn’t recognized,
this method will return None
.
Sourcepub fn to_http_code(self) -> u16
pub fn to_http_code(self) -> u16
Returns an approximation of this message code as an HTTP status code.
Sourcepub fn is_client_error(self) -> bool
pub fn is_client_error(self) -> bool
Returns true if message code is a client error.
Sourcepub fn is_server_error(self) -> bool
pub fn is_server_error(self) -> bool
Returns true if message code is a server error.
Sourcepub fn is_success(self) -> bool
pub fn is_success(self) -> bool
Returns true if message code indicates success.
Trait Implementations§
Source§impl<SD, IC> SendDesc<IC, MsgCode> for EmitMsgCode<SD>
impl<SD, IC> SendDesc<IC, MsgCode> for EmitMsgCode<SD>
Source§fn delay_to_retransmit(&self, retransmits_sent: u32) -> Option<Duration>
fn delay_to_retransmit(&self, retransmits_sent: u32) -> Option<Duration>
Source§fn delay_to_restart(&self) -> Option<Duration>
fn delay_to_restart(&self) -> Option<Duration>
Source§fn max_rtt(&self) -> Duration
fn max_rtt(&self) -> Duration
Source§fn transmit_wait_duration(&self) -> Duration
fn transmit_wait_duration(&self) -> Duration
Source§fn write_options(
&self,
msg: &mut dyn OptionInsert,
socket_addr: &IC::SocketAddr,
start: Bound<OptionNumber>,
end: Bound<OptionNumber>,
) -> Result<(), Error>
fn write_options( &self, msg: &mut dyn OptionInsert, socket_addr: &IC::SocketAddr, start: Bound<OptionNumber>, end: Bound<OptionNumber>, ) -> Result<(), Error>
Source§fn write_payload(
&self,
msg: &mut dyn MessageWrite,
socket_addr: &IC::SocketAddr,
) -> Result<(), Error>
fn write_payload( &self, msg: &mut dyn MessageWrite, socket_addr: &IC::SocketAddr, ) -> Result<(), Error>
msg
.