Skip to content

Draft: Implement defmt::Format for decode errors

This adds the features suggested in #41.

A few notes:

  • I'll need to check whether other errors are best covered in the same to too.
  • So far this is a copy-down of the fmt::Format implementation, I'd like to look more deeply into whether this can be deduplicated (eg. using macros). One key difference that those would need to address is that Utf8DecodeError does not have defmt implemented (but defmt could do that), which means it is dropped instead of being shown. (It also means that the Derive path is not open, but that wasn't the plan anyway).
  • As per the note on #41 it does not add a version number to the defmt dependency. I regard this as impractical because it means that any single version of minicbor can only support a single version of defmt (unless newer defmt versions are added with numbers again), and that the version of defmt can't be changed here without introducing a breaking change to minicbor, but if it works better with the project's development model, that's fine with me too.
  • This is explicitly not licensed under the Blue Oak Model license, because so far I haven't seen any reliable text that explain how the license would not mean that as soon as someone else adds patent any patentially troublesome code and housing prices rise, I don't have to sell my house to buy a patent license for the project. Sounds absurd, but becoming "able to license" could be read thusly. I do license these changes under the terms of CC0 1.0, which does allow anyone to relicense the commits under any other license (so you can re-license it under Blue Oak Model License), but then it is them who sign off the become-able-to-license clause, not me. I'm happy to just add a Signed-Off note and use the Blue Oak license when pointed to some legally reliable text that says that it applies only to patents I own or am otherwise in full control of. (For the record, I'm in control of no patents, am not aware of any that apply, and hold that software patents should not exist in the first place, but that doesn't alter the text of the license). (edit: See comment below)
Edited by chrysn

Merge request reports

Loading