Using wit-bindgen 0.57.1, I'm implementing a component that interposes wasi:sockets@0.3. Both send and receive on tcp-socket use the return type future<result<_, error-code>>. When implementing these methods, I get the error:
error[E0277]: the trait bound `Result<_, exports::wasi::sockets::types::ErrorCode>: FuturePayload` is not satisfied
--> src/lib.rs:325:40
|
325 | let (tx, rx) = wit_future::new(|| Err(ErrorCode::Other(None)));
| --------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FuturePayload` is not implemented for `Result<_, exports::wasi::sockets::types::ErrorCode>`
| |
| required by a bound introduced by this call
|
help: the trait `FuturePayload` is implemented for `Result<(), wasi::sockets::types::ErrorCode>`
The FuturePayload trait is implemented for the imported type, but not implemented for the exported type.
If I manually implement the trait for the exported type using the output of cargo expand, replacing the ErrorCode type with the exports version, everything compiles as expected.
The project as a whole is a work in progress, but I can push the code if that helps.
Using
wit-bindgen 0.57.1, I'm implementing a component that interposeswasi:sockets@0.3. Bothsendandreceiveontcp-socketuse the return typefuture<result<_, error-code>>. When implementing these methods, I get the error:The
FuturePayloadtrait is implemented for the imported type, but not implemented for the exported type.If I manually implement the trait for the exported type using the output of
cargo expand, replacing the ErrorCode type with the exports version, everything compiles as expected.The project as a whole is a work in progress, but I can push the code if that helps.