Skip to content

Conversation

@thomastaylor312
Copy link
Contributor

I discovered this when trying to implement wasi:keyvalue/batch, which returns a list of optionals. There was no Deferred impl for an option decoder, so this adds a simple implementation for it

I discovered this when trying to implement `wasi:keyvalue/batch`, which
returns a list of optionals. There was no `Deferred` impl for an option
decoder, so this adds a simple implementation for it

Signed-off-by: Taylor Thomas <taylor@cosmonic.com>
@thomastaylor312
Copy link
Contributor Author

This is in draft until it can pick up on wrpc/wasm-tokio#1 when it merges and updates

impl_deferred_sync!(CoreVecDecoder<Leb128DecoderU128>);
impl_deferred_sync!(CoreVecDecoder<UnitCodec>);

impl<T, W> Deferred<T> for CoreVecDecoder<OptionDecoder<W>>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not quite right, since it would discard the async value for all option<stream<T>>, option<future<T>> or nested async values (e.g. option of a record, which contains a field of future<T> type)

Copy link
Member

@rvolosatovs rvolosatovs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue here seems to be that the wrong decoder is used for options and results, I've fixed that in #318, could you confirm that it fixes your issue?

@thomastaylor312
Copy link
Contributor Author

Yep, looks like #318 fixed it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants