coap_message_utils

Trait ShowMessageExt

Source
pub trait ShowMessageExt: ReadableMessage + Sized {
    // Provided method
    fn show(&self) -> ShowMessage<'_, Self> { ... }
}
Expand description

Extension trait providing utility functions on coap_message::ReadableMessage.

Provided Methods§

Source

fn show(&self) -> ShowMessage<'_, Self>

Wraps the message to have a core::fmt::Debug imlementation, and also provide [defmt_0_3::Format] if the defmt_0_3 feature is selected.

message.set_code(coap_numbers::code::GET);
message.add_option_str(coap_numbers::option::URI_PATH, "hello");

use coap_message_utils::ShowMessageExt;
let shown = format!("{:?}", message.show());
// The precise format is not fixed, but it contains some usable details:
assert!(shown.contains("code: 0.01 GET"));
assert!(shown.contains("Uri-Path (11):"));

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§