-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
116: feat(module) `Module.exports` uses the new `ExportKind` int enum for the `kind` value r=Hywan a=Hywan This patch creates a new `ExportKind` int enum defined as: ```python class ExportKind(IntEnum): FUNCTION = 1 MEMORY = 2 GLOBAL = 3 TABLE = 4 ``` Since pyo3 doesn't have a mapping from Rust to Python enum (cf PyO3/pyo3#417), we had to find a workaround to create it. I believe the approch taken in this PR isn't too ugly. The enum is created with [the functional API](https://docs.python.org/3/library/enum.html#functional-api), such as: ```python IntEnum("ExportKind", "FUNCTION MEMORY GLOBAL TABLE") ``` Variants order and variant names are defined by implementations on `ExportKind` in Rust. Then, this new `ExportKind` enum is used in `Module.exports` as values of the `kind` pair. Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
- Loading branch information
Showing
4 changed files
with
86 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters