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

get_memory returns a reference but according to docs it shouldn't be #3399

Closed
FranklinWaller opened this issue Dec 1, 2022 · 2 comments
Closed
Assignees
Labels
📚 documentation Do you like to read? 🥇 good first issue Good for newcomers 🍋 Low-hanging Fruit priority-low Low priority issue ❓ question I've a question!
Milestone

Comments

@FranklinWaller
Copy link

FranklinWaller commented Dec 1, 2022

Summary

According to the migration docs (https://github.com/wasmerio/wasmer/blob/master/docs/migration_to_3.0.0.md#after) we can use get_memory to get an instance of Memory and set it in our env (MyEnv). But the return type of get_memory is &Memory not Memory. Because of that i need to set a lifetime parameter on the Env which is incompatible with Function::new_typed_with_env.

Additional details

What i'm trying to do is use memory inside of imports and use WasmPtr to read a string from memory and write to memory

@FranklinWaller FranklinWaller added the ❓ question I've a question! label Dec 1, 2022
@fschutt
Copy link
Contributor

fschutt commented Dec 6, 2022

Thanks for reporting @FranklinWaller! You can safely call .clone() on the Memory to get rid of the lifetime requirement. We need to update our documentation.

@fschutt fschutt self-assigned this Dec 6, 2022
@fschutt fschutt added this to the v3.1 milestone Dec 6, 2022
@ptitSeb ptitSeb modified the milestones: v3.1, v3.2.1 Apr 21, 2023
@ptitSeb
Copy link
Contributor

ptitSeb commented Apr 21, 2023

Fixed, at last, in v3.2.1, closing the ticket.

@ptitSeb ptitSeb closed this as completed Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 documentation Do you like to read? 🥇 good first issue Good for newcomers 🍋 Low-hanging Fruit priority-low Low priority issue ❓ question I've a question!
Projects
None yet
Development

No branches or pull requests

4 participants