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; }

A CoAP message whose code, options and payload can be read

Associated Types

type Code: Code[src]

type MessageOption: MessageOption[src]

Type of an individual option, indiciating its option number and value

type OptionsIter: Iterator<Item = Self::MessageOption>[src]

See options

Loading content...

Required methods

fn code(&self) -> Self::Code[src]

Get the code (request method or response code) of the message

See [Code] for its meaning.

fn payload(&self) -> &[u8][src]

Get the payload set in the message

This is necessarily empty for messages of some codes.

fn options<'a>(&'a self) -> Self::OptionsIter[src]

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.

Loading content...

Implementors

impl ReadableMessage for HeapMessage[src]

type Code = u8

type MessageOption = MessageOption<'a>

type OptionsIter = ReadCursor<'a>

Loading content...