bytecodealliance / bytecodealliance/wasmtime

Add `matches` function to all types structs

Open
#12,193 1 comment 0 reactions 0 assignees View on GitHub
wasmtime:api
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

#### Feature

Currently there exist `FuncType::matches` and `ValType::matches`.

Add `matches` functions to:
- `ExternType`
- `GlobalType`
- `TableType`
- `TagType`

#### Benefit

Quickly checking if a type conforms to an interface.
Asking this in relation to [this wasmi pull request](https://github.com/wasmi-labs/wasmi/pull/1742) to know if there are any plans on implementing functions like this.

#### Implementation

I think it should be possible to compare all fields for either equality or to use the matches functions that are already written.

#### Alternatives

These functions do not have to be written in this crate. They can also be added by users of the library if necessary.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.