Skip to content

Conversation

jacobvm04
Copy link
Collaborator

@jacobvm04 jacobvm04 commented Jun 5, 2024

Closes #15. This PR implements resource support by representing resources as opaque handles. The handles are implemented as lists of bytes wrapped ResourceOwn<T> and ResourceBorrow<T> as outlined in #101.

This PR will supersede #82. This was implemented on new branch due to the significant differences between the opaque handle based approach for representing resources used here vs #82's approach that took a much more prescriptive approach to resource handling.

An example of resources being used with wRPC can be founding in the rust_bindgen test case in tests/rust.rs.

Other than revisions, I believe the main todo item left for this is to decide how to handle drops. I'm a little unsure if resource handlers should be forced to serve a drop method that clients can call, or if wRPC resource hosts and clients should implement their own drop methods that they can call on their own basis. @rvolosatovs thoughts?

@rvolosatovs
Copy link
Member

Other than revisions, I believe the main todo item left for this is to decide how to handle drops. I'm a little unsure if resource handlers should be forced to serve a drop method that clients can call, or if wRPC resource hosts and clients should implement their own drop methods that they can call on their own basis. @rvolosatovs thoughts?

I think the resource handlers will have to implement drop, so essentially it's purely up to the "server" to manage resource lifetimes. For now, I think clients will have to manually call (fallible) drop

Copy link
Member

@rvolosatovs rvolosatovs left a comment

Choose a reason for hiding this comment

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

This actually looks pretty good to me!

@jacobvm04 jacobvm04 marked this pull request as ready for review June 5, 2024 12:34
@rvolosatovs rvolosatovs added this pull request to the merge queue Jun 5, 2024
Merged via the queue into bytecodealliance:main with commit 6babee8 Jun 5, 2024
@jacobvm04 jacobvm04 deleted the wit-bindgen-wrpc-rust-resource-handles branch June 5, 2024 13:16
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.

Resource support in wit-bindgen-wrpc
2 participants