Add a first-class way of accessing caller's exports #1290
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit is a continuation of #1237 and updates the API of
Func
toallow defining host functions which have easy access to a caller's
memory in particular. The new APIs look like so:
Func::wrap*
family of functions was condensed into oneFunc::wrap
function.WasmTy
were removedCaller<'_>
argument can be at the front of allhost-defined functions now.
The old way the wasi bindings looked up memory has been removed and is
now replaced with the
Caller
type. TheCaller
type has aget_export
method on it which allows looking up a caller's export byname, allowing you to get access to the caller's memory easily, and even
during instantiation.