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
Add infallible From conversions for types to ScVal (#1338)
### What
Add infallible From conversions for types to ScVal, replacing the
existing fallible TryFrom conversions.
### Why
When I look through tests I see lots of `try_into().unwrap()` when
converting types to their ScVal values. This is unnecessary, we know
that the conversions will succeed because the host won't give the SDK
types that aren't valid and couldn't be converted. It's just a result of
the way the Rust types are setup we can't guarantee the type is always
convertible, but in practice they are.
Note that this is _not_ really a breaking change, because in the Rust
core lib there is a blanket impl for all From conversions to also
provide a TryFrom conversion. The only behaviour change is that if there
were cases that would fail conversion previously a panic will occur
instead of an error when using a TryFrom to do the conversion. In all
cases there is no expected failure because the Env guarantees valid host
types to be created and we're converting host types to ScVal types.
(cherry picked from commit 8fc9f53)
0 commit comments