pub trait CoapMessageCommon {
Show 15 methods
// Required methods
fn as_message(&self) -> &CoapMessage;
fn as_message_mut(&mut self) -> &mut CoapMessage;
// Provided methods
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§
Sourcefn as_message(&self) -> &CoapMessage
fn as_message(&self) -> &CoapMessage
Returns a reference to this message.
Sourcefn as_message_mut(&mut self) -> &mut CoapMessage
fn as_message_mut(&mut self) -> &mut CoapMessage
Returns a mutable reference to this message.
Provided Methods§
Sourcefn add_option(&mut self, option: CoapOption)
fn add_option(&mut self, option: CoapOption)
Add the supplied CoAP option to this message.
Sourcefn clear_options(&mut self)
fn clear_options(&mut self)
Clear the list of options that were added to this message using add_option().
Sourcefn options_iter(&self) -> Iter<'_, CoapOption>
fn options_iter(&self) -> Iter<'_, CoapOption>
Returns an iterator over the options contained in this message.
Sourcefn type_(&self) -> CoapMessageType
fn type_(&self) -> CoapMessageType
Returns the CoAP message type (confirmable, non-confirmable, acknowledgement, rst) of this message.
Sourcefn set_type_(&mut self, type_: CoapMessageType)
fn set_type_(&mut self, type_: CoapMessageType)
Sets the CoAP message type (confirmable, non-confirmable, acknowledgement, rst) of this message.
Sourcefn code(&self) -> CoapMessageCode
fn code(&self) -> CoapMessageCode
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.
Sourcefn set_code<C: Into<CoapMessageCode>>(&mut self, code: C)
fn set_code<C: Into<CoapMessageCode>>(&mut self, code: C)
Sets the message code of this message.
Sourcefn mid(&self) -> Option<CoapMessageId>
fn mid(&self) -> Option<CoapMessageId>
Returns the CoAP message ID for this message.
Sourcefn set_mid(&mut self, mid: Option<CoapMessageId>)
fn set_mid(&mut self, mid: Option<CoapMessageId>)
Sets the CoAP message ID for this message.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.