Enum MsgCode

Source
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.

§

ClientErrorUnauthorized = 129

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.

§

ServerErrorServiceUnavailable = 163

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

Source

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.

Source

pub fn to_http_code(self) -> u16

Returns an approximation of this message code as an HTTP status code.

Source

pub fn is_empty(self) -> bool

Returns true if this is the empty code.

Source

pub fn is_method(self) -> bool

Returns true if message code is a method.

Source

pub fn is_client_error(self) -> bool

Returns true if message code is a client error.

Source

pub fn is_server_error(self) -> bool

Returns true if message code is a server error.

Source

pub fn is_error(self) -> bool

Returns true if message code is any sort of error.

Source

pub fn is_success(self) -> bool

Returns true if message code indicates success.

Source

pub fn is_signal(self) -> bool

Returns true if message code is an in-band signal.

Trait Implementations§

Source§

impl Clone for MsgCode

Source§

fn clone(&self) -> MsgCode

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MsgCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MsgCode

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<MsgCode> for u16

Source§

fn from(code: MsgCode) -> Self

Converts to this type from the input type.
Source§

impl From<MsgCode> for u32

Source§

fn from(code: MsgCode) -> Self

Converts to this type from the input type.
Source§

impl From<MsgCode> for u8

Source§

fn from(code: MsgCode) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for MsgCode

Source§

fn eq(&self, other: &MsgCode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<SD, IC> SendDesc<IC, MsgCode> for EmitMsgCode<SD>
where SD: SendDesc<IC, ()> + Send, IC: InboundContext,

Source§

fn delay_to_retransmit(&self, retransmits_sent: u32) -> Option<Duration>

Calculates the duration of the delay to wait before sending the next retransmission. Read more
Source§

fn delay_to_restart(&self) -> Option<Duration>

The delay to wait between when we have received a successful response and when we should send out another request. Read more
Source§

fn max_rtt(&self) -> Duration

The maximum time to wait for an asynchronous response after having received an ACK.
Source§

fn transmit_wait_duration(&self) -> Duration

the maximum time from the first transmission of a Confirmable message to the time when the sender gives up on receiving an acknowledgement or reset.
Source§

fn write_options( &self, msg: &mut dyn OptionInsert, socket_addr: &IC::SocketAddr, start: Bound<OptionNumber>, end: Bound<OptionNumber>, ) -> Result<(), Error>

Defines which options are going to be included in the outbound message. Read more
Source§

fn write_payload( &self, msg: &mut dyn MessageWrite, socket_addr: &IC::SocketAddr, ) -> Result<(), Error>

Generates the outbound message by making calls into msg.
Source§

fn supports_option(&self, option: OptionNumber) -> bool

Experimental: Used for determining if the given option seen in the reply message is supported or not. Read more
Source§

fn handler( &mut self, context: Result<&IC, Error>, ) -> Result<ResponseStatus<MsgCode>, Error>

Handles the response to the outbound message.
Source§

fn trans_params(&self) -> Option<TP>

Experimental: Gets custom transmission parameters.
Source§

impl Copy for MsgCode

Source§

impl Eq for MsgCode

Source§

impl StructuralPartialEq for MsgCode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V