Skip to content

Why does Memory::view require a store parameter? #3675

Answered by jcaesar
4LT asked this question in General
Discussion options

You must be logged in to vote
  • Passing a store is required to ensure thread-safe access to the memory. The memory object can be shared and passed around, but the store access is restricted.
  • Passing an unrelated store is unlikely to be valid, but I haven't tried.
  • (In case you're trying to access the memory from a callback: You can use Function::new_typed_with_env, receive a FunctionEnvMut, and that implements AsStoreRef, giving you access.)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by syrusakbary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants