Trait coap_message::ReadableMessage [−][src]
pub trait ReadableMessage {
type Code: Code;
type MessageOption: MessageOption;
type OptionsIter: Iterator<Item = Self::MessageOption>;
fn code(&self) -> Self::Code;
fn payload(&self) -> &[u8];
fn options<'a>(&'a self) -> Self::OptionsIter;
}Expand description
A CoAP message whose code, options and payload can be read
Associated Types
See code; also used with MinimalWritableMessage::set_code()
Type of an individual option, indiciating its option number and value
type OptionsIter: Iterator<Item = Self::MessageOption>
type OptionsIter: Iterator<Item = Self::MessageOption>
See options
Required methods
Get the code (request method or response code) of the message
See [Code] for its meaning.
Get the payload set in the message
This is necessarily empty for messages of some codes.
fn options<'a>(&'a self) -> Self::OptionsIter
fn options<'a>(&'a self) -> Self::OptionsIter
Produce all options in arbitrary order as an iterator
If your options are always produced in an ordered fashion, consider implementing the
WithSortedOptions trait as well. This should be the case for most CoAP
message backends. Examples of backends where it is not implemented are single-pass reads
over in-place decrypted OSCORE messages.