Trait coap_message::ReadableMessage
source · [−]pub trait ReadableMessage {
type Code: Code;
type MessageOption<'a>: MessageOption
where
Self: 'a;
type OptionsIter<'a>: Iterator<Item = Self::MessageOption<'a>>
where
Self: 'a;
fn code(&self) -> Self::Code;
fn payload(&self) -> &[u8];
fn options(&self) -> Self::OptionsIter<'_>;
}
Expand description
A CoAP message whose code, options and payload can be read
Required Associated Types
See code; also used with MinimalWritableMessage::set_code()
sourcetype MessageOption<'a>: MessageOption
where
Self: 'a
type MessageOption<'a>: MessageOption
where
Self: 'a
Type of an individual option, indiciating its option number and value
sourcetype OptionsIter<'a>: Iterator<Item = Self::MessageOption<'a>>
where
Self: 'a
type OptionsIter<'a>: Iterator<Item = Self::MessageOption<'a>>
where
Self: 'a
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.
sourcefn options(&self) -> Self::OptionsIter<'_>
fn options(&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.