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
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:
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.
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:
rs-stellar-xdr/src/curr/scval_conversions.rs
Lines 507 to 529 in 8b9d623
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:
The text was updated successfully, but these errors were encountered: