You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I decided to address this in the Q&A forum as I am not sure if this is an issue or an intended design decision.
TL;DR: Escaping quotation marks in defmt::Format implementations is not supported.
Using the implementation impl defmt::Format for Key from esp-nvs as an example:
pubstructKey([u8;16]);implKey{// .../// Returns the key as a string slice, excluding null padding.pubfnas_str(&self) -> &str{let len = self.0.iter().position(|&b| b == 0).unwrap_or(self.0.len());unsafe{ core::str::from_utf8_unchecked(&self.0[..len])}}}impl defmt::FormatforKey{fnformat(&self,f: defmt::Formatter){
defmt::write!(f,"{}",self.as_str());}}
The code above works as intended but however the following code
× failed to demangle defmt symbol `{"package":"esp-nvs","tag":"defmt_write","data":"Key(b"","disambiguator":"10210432388362800501","crate_name":"esp_nvs"}`: expected `,` or `}` at line 1 column 56
╰─▶ Failed to parse defmt data
Based on the error it seems that this behavior is unintended however I could be mistaken. I would appreciate any clarity on this matter, thank you.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I decided to address this in the Q&A forum as I am not sure if this is an issue or an intended design decision.
TL;DR: Escaping quotation marks in
defmt::Formatimplementations is not supported.Using the implementation
impl defmt::Format for Keyfrom esp-nvs as an example:The code above works as intended but however the following code
Produces the error
× failed to demangle defmt symbol `{"package":"esp-nvs","tag":"defmt_write","data":"Key(b"","disambiguator":"10210432388362800501","crate_name":"esp_nvs"}`: expected `,` or `}` at line 1 column 56 ╰─▶ Failed to parse defmt dataBased on the error it seems that this behavior is unintended however I could be mistaken. I would appreciate any clarity on this matter, thank you.
Beta Was this translation helpful? Give feedback.
All reactions