Files
tmp/examples/format.rs
Lionel Sambuc ba09e87c1e stars, moon, trees, houses and snow
* Version of Family Christmas 2024
2024-12-28 08:27:33 +01:00

30 lines
471 B
Rust

#![no_main]
#![no_std]
use defmt::Format; // <- derive attribute
use template_microbit as _; // global logger + panicking-behavior + memory layout
#[derive(Format)]
struct S1<T> {
x: u8,
y: T,
}
#[derive(Format)]
struct S2 {
z: u8,
}
#[cortex_m_rt::entry]
fn main() -> ! {
let s = S1 {
x: 42,
y: S2 { z: 43 },
};
defmt::println!("s={:?}", s);
let x = 42;
defmt::println!("x={=u8}", x);
template_microbit::exit()
}