Closes #651 : Modify host_bindgen proc_macro to support selecting specific world#1020
Conversation
da27f99 to
b5e04a0
Compare
44804b7 to
2136234
Compare
2136234 to
9729db2
Compare
ludfjig
left a comment
There was a problem hiding this comment.
Looks nice! Some minor nits. Also I assigned copilot to see if it has any suggestions
|
0dad0d8 to
4d789a7
Compare
7c27985 to
7d7917a
Compare
7d7917a to
835395b
Compare
ludfjig
left a comment
There was a problem hiding this comment.
Thanks a lot for this! Looks good to me, but will defer to @syntactically to have a look as well
There was a problem hiding this comment.
Pull request overview
This PR implements the ability to select a specific world from a WIT file that contains multiple worlds, addressing issue #651. Previously, the host_bindgen and guest_bindgen macros would automatically select the last exported world. Now users can explicitly specify which world to use via a new structured syntax.
Key Changes:
- Extended
host_bindgenandguest_bindgenproc macros to accept structured input with{path: "...", world_name: "..."}syntax - Modified component parsing logic to select a world by name when specified, falling back to the last world for backward compatibility
- Added test case demonstrating world selection with a new two-world WIT file
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/rust_guests/witguest/two_worlds.wit | Adds a new WIT file defining two worlds (firstworld and secondworld) for testing world selection functionality |
| src/hyperlight_host/tests/wit_test.rs | Adds test module demonstrating the new world selection syntax using firstworld from the two-world WIT file |
| src/hyperlight_component_util/src/util.rs | Updates read_wit_type_from_file to accept an optional world_name parameter and pass it to component parsing |
| src/hyperlight_component_util/src/component.rs | Implements world selection logic in read_component_single_exported_type to find worlds by name when specified |
| src/hyperlight_component_macro/src/lib.rs | Adds BindgenInputParams struct with custom parser to support both legacy path-only syntax and new structured syntax with path and world_name |
| Justfile | Adds build command for the new two_worlds.wit test file to generate twoworlds.wasm |
f8d97ef to
4d789a7
Compare
e45cedd to
af04846
Compare
af04846 to
6e8b305
Compare
jsturtevant
left a comment
There was a problem hiding this comment.
Looks great, Just a couple minor questions but the structure looks right!
- adds support to select a specific world from a WIT file if multiple worlds are specified. Signed-off-by: Shailesh Vashishth <shavashishth@gmail.com>
34c3c30 to
da0972d
Compare
fixes: #651
host_bindgen and guest_bindgen accepts two type of inputs now