Hello
Right now I’m trying to implement a solution to this issue: https://github.com/stellar/rs-soroban-sdk/issues/877
The error it should solve is
error[E0277]: the trait bound `soroban_sdk::xdr::ScVal: From<&core::option::Option<i128>>` is not satisfied
--> src/lib.rs:13:1
|
13 | #[contracttype]
| ^^^^^^^^^^^^^^^ the trait `From<&core::option::Option<i128>>` is not implemented for `soroban_sdk::xdr::ScVal`
|
= note: required for `&core::option::Option<i128>` to implement `Into<soroban_sdk::xdr::ScVal>`
= note: required for `soroban_sdk::xdr::ScVal` to implement `TryFrom<&core::option::Option<i128>>`
= note: required for `&core::option::Option<i128>` to implement `TryInto<soroban_sdk::xdr::ScVal>`
= note: this error originates in the attribute macro `contracttype` (in Nightly builds, run with -Z macro-backtrace for more info)
From what I understand the problem needs something like this to solve it
impl<T: Into<ScVal>> Into<ScVal> for Option<T> {
fn into(self) -> ScVal {
// code…
}
}
So to do it, the implementation should be in the repository that has ScVal(rs-stellar-xdr) ?
BTW the same issue is in rs-soroban-env https://github.com/stellar/rs-soroban-env/issues/444
That already has an option file with these two impl, that is getting me a bit confused
The questions would be, in what repo should be implemented the solution for this? (I think is rs-stellar-xdr) and what I think is the solution to the problem really is or am I lacking in my knowledge of Rust?