MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / with

Method with

crates/wasmtime/src/runtime/component/concurrent.rs:458–465  ·  view source on GitHub ↗

Run the specified closure, passing it mutable access to the store. This function is one of the main building blocks of the [`Accessor`] type. This yields synchronous, blocking, access to the store via an [`Access`]. The [`Access`] implements [`AsContextMut`] in addition to providing the ability to access `D` via [`Access::get`]. Note that the `fun` here is given only temporary access to the store

(&self, fun: impl FnOnce(Access<'_, T, D>) -> R)

Source from the content-addressed store, hash-verified

456 /// then this function will panic. It is up to the embedder to ensure that
457 /// this does not happen.
458 pub fn with<R>(&self, fun: impl FnOnce(Access<'_, T, D>) -> R) -> R {
459 tls::get(|vmstore| {
460 fun(Access {
461 store: self.token.as_context_mut(vmstore),
462 get_data: self.get_data,
463 })
464 })
465 }
466
467 /// Returns the getter this accessor is using to project from `T` into
468 /// `D::Data`.

Callers 15

set_thread_profilerFunction · 0.45
start_passFunction · 0.45
take_currentFunction · 0.45
start_passMethod · 0.45
dropMethod · 0.45
sysv_clobbersFunction · 0.45
tail_clobbersFunction · 0.45
all_clobbersFunction · 0.45
sysv_create_machine_envFunction · 0.45
tail_create_machine_envFunction · 0.45
windows_clobbersFunction · 0.45
sysv_clobbersFunction · 0.45

Calls 2

getFunction · 0.50
as_context_mutMethod · 0.45

Tested by 10

async_closed_streamFunction · 0.36
test_async_short_readsFunction · 0.36
fooMethod · 0.36
runFunction · 0.36
runMethod · 0.36
async_readinessFunction · 0.36
callMethod · 0.36
test_transmit_withFunction · 0.36