maidsafe / sn_dbc

Safe Network DBCs
BSD 3-Clause "New" or "Revised" License
15 stars 16 forks source link

Hash pr #33

Closed dan-da closed 3 years ago

dan-da commented 3 years ago

These are some mods I made to enable displaying mint and dbc information nicely in a CLI.

The largest part of the PR changes Hash to use newtype pattern instead of a type alias. I initially did this in order to impl fmt::Display and Debug on Hash for pretty printing using base64 encoding. However, I discovered that fmt::Display really cannot do what I need, so in the end the app does all the display formatting itself. I also reverted the custom base64 encoding in Hash::Debug, as I figure it is perhaps better to display the raw data/structure in Debug mode. As such, the newtype pattern could be reverted from the PR, but I think it is useful to keep, as it makes it easy/possible to add functionality to Hash and DbcContentHash in the future.

Other changes are:

These last two are relied upon by the cli mint prototype.