[][src]Trait coap_message::MinimalWritableMessage

pub trait MinimalWritableMessage {
    type Code: Code;
    type OptionNumber: OptionNumber;
    fn set_code(&mut self, code: Self::Code);
fn add_option(&mut self, number: Self::OptionNumber, value: &[u8]);
fn set_payload(&mut self, data: &[u8]); fn set_from_message<'m, M>(&mut self, msg: &'m M)
    where
        M: ReadableMessage<'m>
, { ... } }

A message that needs to have its code, any options in ascending order and its payload set in that very sequence.

This is the bare minimum a message needs to provide to be populated as a request or response by a generic program; it is up to the program to ensure the valid sequence of operations, as failure to do so may incur panics (FIXME: or errors).

Associated Types

Loading content...

Required methods

fn set_code(&mut self, code: Self::Code)

fn add_option(&mut self, number: Self::OptionNumber, value: &[u8])

fn set_payload(&mut self, data: &[u8])

Loading content...

Provided methods

fn set_from_message<'m, M>(&mut self, msg: &'m M) where
    M: ReadableMessage<'m>, 

Copy code, options and payload in from a readable message

Implementations can override this for cases where it can be done more efficiently than iterating over the options and appending them.

Loading content...

Implementors

Loading content...