Open leighmcculloch opened 8 months ago
Introducing TryFrom conversions for Option may have some conflicts on other trait impls, so we'll need to test the change that attempts to fix this up most of the stack up to at least the SDK before committing to a fix.
It appears that the Option type only has conversions to ScVal as infallible, and therefore only has conversions for versions of T that are also infallible:
https://github.com/stellar/rs-stellar-xdr/blob/8b9d623ef40423a8462442b86997155f2c04d3a1/src/curr/scval_conversions.rs#L507-L529
This makes the use and compatibility of Option as a Soroban type limited, since many other types are only convertible through the Try interface because they can error.
Custom types only require TryFrom and not From.
Option should be implemented for TryFrom, instead of From, so that it is usable in custom types with a wider variety of T's.
Related discussion: