You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This occurs due to default implementation of ToString in standard library: impl<T: Display + ?Sized> ToString for T
Proposed solution
swap realizations for Debug and Display
Advantages
More suitable implementations of formatting traits (Shortened is useful for quick eye-checking, and when Display-ing to user we usually need full hash.)
Generates same amount of code, do not increase load to compiler
Disadvantages
It's a breaking change
Alternative solution
add codegen for ToString, which will return full version of hash
Advantages
Non-breaking change
Disadvantage
Generates more code, slowing compilation a bit
Leaves unsuitable implementation of formatting traits
The text was updated successfully, but these errors were encountered:
add codegen for ToString, which will return full version of hash
Wouldn't the alternate solution also be a breaking change? If somebody already is using to_string() and counts that it will only give him the shortened version? Just curious.
If we could get this changed it would be great IMO.
How to reproduce
here is snippet
Expected results
to_string()
returns string representation of H160Real results
to_string()
returns shortened versionSource of problem
This occurs due to default implementation of
ToString
in standard library:impl<T: Display + ?Sized> ToString for T
Proposed solution
swap realizations for
Debug
andDisplay
Advantages
Display
-ing to user we usually need full hash.)Disadvantages
Alternative solution
add codegen for
ToString
, which will return full version of hashAdvantages
Disadvantage
The text was updated successfully, but these errors were encountered: