Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:x for arrays with inferred format #925

Open
jonathanpallant opened this issue Jan 20, 2025 · 1 comment
Open

:x for arrays with inferred format #925

jonathanpallant opened this issue Jan 20, 2025 · 1 comment
Labels
good first issue Good for newcomers type: bug Something isn't working

Comments

@jonathanpallant
Copy link
Contributor

The manual says you can do this, and it works:

#[derive(defmt::Format)]
struct S { x: u8 }

let x = S { x: 42 };
defmt::info!("{}", x);    // -> INFO S { x: 42 }
defmt::info!("{:x}", x); // -> INFO S { x: 0x2a }

But this does not work, but it probably should:

#[derive(defmt::Format)]
struct S { x: [u8; 2] }

let x = S { x: [42, 255] };
defmt::info!("{}", x);    // -> INFO S { x: [42, 255] }
defmt::info!("{:x}", x); // -> I expect INFO S { x: [0x2a, 0xff] } but it's the same as before
@Urhengulas
Copy link
Member

I agree with you and would also expect this to work.

@Urhengulas Urhengulas added type: bug Something isn't working good first issue Good for newcomers labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants