platform/
metadata.rs

1use core::fmt;
2use serde::Serialize;
3
4#[derive(Serialize)]
5pub struct ApplicationMetadata {
6    pub firmware_version: &'static str,
7    pub rust_version: &'static str,
8    pub profile: &'static str,
9    pub git_dirty: bool,
10    pub features: &'static str,
11    pub panic_info: &'static str,
12    pub hardware_version: &'static str,
13}
14
15impl fmt::Display for ApplicationMetadata {
16    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17        f.write_fmt(format_args!(
18            "{:<20}: {} [{}]",
19            "Version", self.firmware_version, self.profile,
20        ))?;
21        f.write_fmt(format_args!(
22            "{:<20}: {}",
23            "Hardware Revision", self.hardware_version
24        ))?;
25        f.write_fmt(format_args!(
26            "{:<20}: {}",
27            "Rustc Version", self.rust_version
28        ))?;
29        f.write_fmt(format_args!("{:<20}: {}", "Features", self.features))?;
30        f.write_fmt(format_args!("{:<20}: {}", "Panic Info", self.panic_info))?;
31        Ok(())
32    }
33}