pub trait ShowCodeExt: Code {
// Provided methods
fn show_dotted(self) -> ShowDotted { ... }
fn show_named(self) -> ShowNamed { ... }
fn show_dotted_and_named(self) -> ShowDottedAndNamed { ... }
}
Expand description
Extension trait providing utility functions on coap_message::Code.
Provided Methods§
Sourcefn show_dotted(self) -> ShowDotted
fn show_dotted(self) -> ShowDotted
Wraps the code to have a core::fmt::Debug
imlementation that produces dotted format,
and also provides [defmt_0_3::Format
] if the defmt_0_3
feature is selected.
use coap_message_utils::ShowCodeExt;
assert_eq!("2.05", format!("{:?}", coap_numbers::code::CONTENT.show_dotted()));
Sourcefn show_named(self) -> ShowNamed
fn show_named(self) -> ShowNamed
Wraps the code to have a core::fmt::Debug
imlementation that produces the code’s name
(falling back to dotted format), and also provides [defmt_0_3::Format
] if the defmt_0_3
feature is selected.
use coap_message_utils::ShowCodeExt;
assert_eq!("Content", format!("{:?}", coap_numbers::code::CONTENT.show_named()));
assert_eq!("0.31", format!("{:?}", 31u8.show_named()));
Sourcefn show_dotted_and_named(self) -> ShowDottedAndNamed
fn show_dotted_and_named(self) -> ShowDottedAndNamed
Wraps the code to have a core::fmt::Debug
imlementation that produces the code’s name
(falling back to dotted format), and also provides [defmt_0_3::Format
] if the defmt_0_3
feature is selected.
use coap_message_utils::ShowCodeExt;
assert_eq!("2.05 Content", format!("{:?}", coap_numbers::code::CONTENT.show_dotted_and_named()));
assert_eq!("0.31", format!("{:?}", 31u8.show_dotted_and_named()));
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.