Example: uFmt_f32/uFmt_f64
I was surprised hitting bigger problems than expected when trying to format a string and writting to a serial port. This issue is partly related to #302.
In a nutshell, it would be great to see a working example such as:
let value = 3.1415926_f32;
let value_write = uFmt_f32::Two(value); // 3.14
ufmt::uwriteln!(&mut serial, "value: {}", value_write);
The issue I hit was the trait uDisplayis not implemented foruFmt_f32despite the fact thatuFmt_f32` does implement it.
Can you check your dependency tree on whether avr-hal and ufmt_float both depend on the same version of ufmt? Easiest way to do this is using cargo tree.
Ah indeed:
c tree -i ufmt
error: There are multiple `ufmt` packages in your project, and the specification `ufmt` is ambiguous.
Please re-run this command with `-p <spec>` where `<spec>` is one of the following:
[email protected]
[email protected]
NOTE: heapless::string (and alloc::... even less) is, unlike what I initiall thought, not required for such an example to work.
FYI: ufmt_loat was published on crates.io but there was no public repo. I contacted the author who nicely published the repo. I also lined up a PR so ufmt_float no longer depends on an ancient ufmt.