wapc / wapc-rs

waPC Rust monorepo
Apache License 2.0
75 stars 9 forks source link

Introduce async support #96

Closed flavio closed 1 month ago

flavio commented 2 months ago

This is a massive change required to fix https://github.com/wapc/wapc-rs/issues/92

Changes to wapc crate

Allow waPC host to be used inside of an asynchronous runtime

New structs and traits have been added:

An async runtime has an async host callback function. The new type alias HostCallbackAsync is used to define this function. The signature of this function is slightly different from the one of the sync counterpart. All the input paremeters are owned types, not pointers. That's required because the function can be sent to different threads by the async runtime; introducing lifetime constraints proved to be impossible.

The async support is behind a feature flag named asyc. This flag is enabled by default. The implementation relies on the tokio crate.

Other notable changes:

Changes to wasmtime-provider crate

New structs and traits have been added:

The async support is behind a feature flag named asyc. This flag is enabled by default. The implementation relies on the tokio crate.

Other notable changes:

flavio commented 2 months ago

Once merged, we will have to tag new release of wapc and wasmtime-provider. I wonder if we should do a major release instead of a minor one.

Ideas?

pkedy commented 2 months ago

Thanks for get awesome description! I agree this probably warrants a new major release. I'm a little busy but I will review this as soon.

flavio commented 2 months ago

@pkedy, did you have chance to look at the PR? :pray:

flavio commented 1 month ago

@pkedy can you please take a look at the PR? :pray:

flavio commented 1 month ago

I've rebased the PR against the latest changed that landed into the master branch. I'll merge it once everything is green

flavio commented 1 month ago

wasmtime-provider 2.0.0 and wapc 2.0.0 are now available on crates.io 🥳