[][src]Trait async_coap::message::MessageRead

pub trait MessageRead {
    fn msg_code(&self) -> MsgCode;
fn msg_type(&self) -> MsgType;
fn msg_id(&self) -> MsgId;
fn msg_token(&self) -> MsgToken;
fn payload(&self) -> &[u8];
fn options(&self) -> OptionIterator;
fn content_format(&self) -> Option<ContentFormat>;
fn accept(&self) -> Option<ContentFormat>;
fn block2(&self) -> Option<BlockInfo>;
fn block1(&self) -> Option<BlockInfo>; fn write_msg_to(&self, target: &mut dyn MessageWrite) -> Result<(), Error> { ... }
fn payload_as_str(&self) -> Option<&str> { ... } }

Trait for reading the various parts of a CoAP message.

Required methods

fn msg_code(&self) -> MsgCode

Gets the message code for this message.

fn msg_type(&self) -> MsgType

Gets the message type for this message.

fn msg_id(&self) -> MsgId

Gets the message id for this message.

fn msg_token(&self) -> MsgToken

Gets the message token for this message.

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

Gets the payload as a byte slice.

Important traits for OptionIterator<'a>
fn options(&self) -> OptionIterator

Gets an iterator for processing the options of the message.

fn content_format(&self) -> Option<ContentFormat>

Indicates the content format of the payload, if specified.

fn accept(&self) -> Option<ContentFormat>

Indicates the content format that the sender of the message will accept for the payload of the response, if specified.

fn block2(&self) -> Option<BlockInfo>

Returns the value of the block2 option for this message, if any.

fn block1(&self) -> Option<BlockInfo>

Returns the value of the block1 option for this message, if any.

Loading content...

Provided methods

fn write_msg_to(&self, target: &mut dyn MessageWrite) -> Result<(), Error>

Writes this message to the given target that implements MessageWrite.

If this message has a message id (msg_id) of zero, the message id will not be written to target.

fn payload_as_str(&self) -> Option<&str>

Gets the payload as a string slice.

Loading content...

Trait Implementations

impl<'a> ToOwned for dyn MessageRead + 'a[src]

type Owned = OwnedImmutableMessage

The resulting type after obtaining ownership.

fn clone_into(&self, target: &mut Self::Owned)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<'a> Borrow<dyn MessageRead + 'a> for OwnedImmutableMessage[src]

Implementors

impl MessageRead for AckMessage[src]

impl MessageRead for NullMessageRead[src]

impl MessageRead for OwnedImmutableMessage[src]

impl MessageRead for ResetMessage[src]

impl<'buf> MessageRead for StandardMessageParser<'buf>[src]

Loading content...