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
{{ message }}
This repository was archived by the owner on Aug 21, 2024. It is now read-only.
TryFrom is for type conversion. The implementation here reads from disk and does json parsing, we are way beyond type conversion. Nothing from the resulting type can be found in the original one. By this logic, any function that takes one single argument and returns another single different type could be implemented as From/TryFrom.
Now, what if I also want to offer a way to create the type from a toml file? I can only have a single implem of TryFrom<&Path> for VersionedConstants, so I have to add it to the existing one? How do I know if I should expect a toml or a json. This is obviously a bad design.
The correct way here is to add a from_json_file method to the impl VersionedConstant block.