pub struct CoapMessage { /* private fields */ }
Expand description

Representation of a CoAP message.

Implementations

Creates a new CoAP message with the given type and code.

Parses the given raw coap_pdu_t into a CoapMessage.

Safety

raw_pdu must point to a valid instance of coap_pdu_t.

Converts this message into a raw PDU suitable for sending using the raw coap_send() function.

The caller is responsible for freeing the returned PDU, either by calling coap_send() or coap_delete_pdu().

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns a reference to this message.
Returns a mutable reference to this message.
Add the supplied CoAP option to this message.
Clear the list of options that were added to this message using add_option().
Returns an iterator over the options contained in this message.
Returns the CoAP message type (confirmable, non-confirmable, acknowledgement, rst) of this message.
Sets the CoAP message type (confirmable, non-confirmable, acknowledgement, rst) of this message.
Returns the message code of this message. To determine whether the message is a request or response, use CoapMessageCode::try_from() and match for the enum variants. Read more
Sets the message code of this message.
Returns the CoAP message ID for this message.
Sets the CoAP message ID for this message.
Returns a reference to the data/body of this message.
Sets the data/body of this message.
Returns the message token.
Sets the message token. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.