Skip to content

Conversation

@BoilingFusion
Copy link

Add Add matches function to all types structs

closes #12193

For the matching functions it follows these specs.

Adds:

  • ExternType::matches
  • ExternType::eq
  • GlobalType::matches
  • GlobalType::eq
  • TableType::matches
  • TableType::eq
  • MemoryType::matches
  • MemoryType::eq
  • TagType::matches
  • TagType::eq

Julian Adamse added 3 commits December 22, 2025 23:41
Add matches to:
- `GlobalType`
- `TableType`
- `MemoryType`
- `TagType`
Add `eq` functions to:
- `GlobalType`
- `TableType`
- `MemoryType`
- `TagType`
@BoilingFusion BoilingFusion requested a review from a team as a code owner December 22, 2025 23:30
@BoilingFusion BoilingFusion requested review from fitzgen and removed request for a team December 22, 2025 23:30
@BoilingFusion
Copy link
Author

I think its correct.
Although things did turn out a little bit less trivial than expected. Luckly the spec was pretty clear on when types matched.
Some extra focus on reviewing TagTypes would be helpfull since the spec for TagTypes matching was more complex than for the others.

@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Dec 23, 2025
@alexcrichton
Copy link
Member

This looks like it's largely a duplication of this file, would it be possible to avoid reimplementing that file and using the implementations there instead? Reusing an implementation would reduce the need for tests, and otherwise this will need tests as opposed to just adding the methods.

@BoilingFusion
Copy link
Author

Im afraid that file implements the methods for Global and Memory, etc instead of for GlobalType and MemoryType etc.

Its kind of hard to use these since you would first have to create a Global from the GlobalType to do the comparison. The other way around should be more natural.

What would be the appropriate place to add the tests?

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.

Add matches function to all types structs

2 participants