Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support fetching imports from a Module #372

Merged
merged 14 commits into from
Sep 30, 2024

Conversation

davejcameron
Copy link
Contributor

Add support for fetching the list of Module imports.

ext/src/ruby_api/module.rs Outdated Show resolved Hide resolved
let hash = RHash::new();
hash.aset("module", import.module())?;
hash.aset("name", import.name())?;
hash.aset("type", format!("{:?}", import.ty()))?;
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we want to return a string for the type, ideally we'd want a proper type representing the extern. I believe you can use https://github.com/bytecodealliance/wasmtime-rb/blob/main/ext/src/ruby_api/externals.rs#L110

Copy link
Member

@saulecabrera saulecabrera left a comment

Choose a reason for hiding this comment

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

Looks good to me; there are couple of docs that need updating and after we should be able to land this one.

/// @yard
/// Returns the exported function's FuncType or raises a `{ConversionError}` when the export is not a
/// function.
/// @return [Func] The exported function.
Copy link
Member

Choose a reason for hiding this comment

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

I believe here it should be

@return [FuncType]

In the signatures below as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch! Fixed.

@saulecabrera saulecabrera merged commit 27bc48c into bytecodealliance:main Sep 30, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants