Skip to content

Conversation

@alexcrichton
Copy link
Member

This commit is the first step down the road of filling out the preexisting, but empty/buggy, FutureAny and StreamAny types. These are intended to behave similarly to ResourceAny where the embedder doesn't have static knowledge ahead of time about the type of the future/stream in use. Changes made here are:

  • ComponentType for {Stream,Future}Reader<T> now correctly typecheck the T.
  • Conversion to/from *Any types now properly typechecks the payload type against the expected type.
  • {Future,Stream}Any now live in their own file with the matrix of conversions to the typed variants.
  • A close method was added to *Any types.

These types are not currently directly constructible but this will likely be relaxed in the future. Additionally the host can't actually use these values without knowing the type, which is another restriction that will be relaxed in the future (aka implemented).

cc #11161

This commit is the first step down the road of filling out the
preexisting, but empty/buggy, `FutureAny` and `StreamAny` types. These
are intended to behave similarly to `ResourceAny` where the embedder
doesn't have static knowledge ahead of time about the type of the
future/stream in use. Changes made here are:

* `ComponentType for {Stream,Future}Reader<T>` now correctly typecheck
  the `T`.
* Conversion to/from `*Any` types now properly typechecks the payload
  type against the expected type.
* `{Future,Stream}Any` now live in their own file with the matrix of
  conversions to the typed variants.
* A `close` method was added to `*Any` types.

These types are not currently directly constructible but this will
likely be relaxed in the future. Additionally the host can't actually
use these values without knowing the type, which is another restriction
that will be relaxed in the future (aka implemented).

cc bytecodealliance#11161
@alexcrichton alexcrichton requested a review from dicej December 8, 2025 23:53
@alexcrichton alexcrichton requested a review from a team as a code owner December 8, 2025 23:53
@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Dec 9, 2025
Copy link
Contributor

@dicej dicej left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

@alexcrichton alexcrichton added this pull request to the merge queue Dec 9, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 9, 2025
@alexcrichton alexcrichton added this pull request to the merge queue Dec 9, 2025
Merged via the queue into bytecodealliance:main with commit f586be1 Dec 9, 2025
45 checks passed
@alexcrichton alexcrichton deleted the start-filling-out-future-and-stream-any branch December 9, 2025 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants