pub trait CoapMessageCommon {
Show 15 methods fn as_message(&self) -> &CoapMessage; fn as_message_mut(&mut self) -> &mut CoapMessage; fn add_option(&mut self, option: CoapOption) { ... } fn clear_options(&mut self) { ... } fn options_iter(&self) -> Iter<'_, CoapOption> { ... } fn type_(&self) -> CoapMessageType { ... } fn set_type_(&mut self, type_: CoapMessageType) { ... } fn code(&self) -> CoapMessageCode { ... } fn set_code<C: Into<CoapMessageCode>>(&mut self, code: C) { ... } fn mid(&self) -> Option<CoapMessageId> { ... } fn set_mid(&mut self, mid: Option<CoapMessageId>) { ... } fn data(&self) -> Option<&[u8]> { ... } fn set_data<D: Into<Box<[u8]>>>(&mut self, data: Option<D>) { ... } fn token(&self) -> Option<&[u8]> { ... } fn set_token<D: Into<Box<[u8]>>>(&mut self, token: Option<D>) { ... }
}
Expand description

Interface for CoAP messages common between requests, responses and other messages.

Required Methods

Returns a reference to this message.

Returns a mutable reference to this message.

Provided Methods

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.

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.

Note that CoapSessionCommon::send_request() will automatically set the token to a random value if you don’t.

Implementors