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

Method data

crates/wasmtime/src/runtime/memory.rs:408–415  ·  view source on GitHub ↗

Returns this memory as a native Rust slice. Note that this method will consider the entire store context provided as borrowed for the duration of the lifetime of the returned slice. # Panics Panics if this memory doesn't belong to `store`.

(&self, store: impl Into<StoreContext<'a, T>>)

Source from the content-addressed store, hash-verified

406 ///
407 /// Panics if this memory doesn't belong to `store`.
408 pub fn data<'a, T: 'static>(&self, store: impl Into<StoreContext<'a, T>>) -> &'a [u8] {
409 unsafe {
410 let store = store.into();
411 let definition = store[self.instance].memory(self.index);
412 debug_assert!(!self.ty(store).is_shared());
413 slice::from_raw_parts(definition.base.as_ptr(), definition.current_length())
414 }
415 }
416
417 /// Returns this memory as a native Rust mutable slice.
418 ///

Callers 1

readMethod · 0.45

Calls 6

current_lengthMethod · 0.80
memoryMethod · 0.45
as_ptrMethod · 0.45
as_refMethod · 0.45
vmmemory_ptrMethod · 0.45
castMethod · 0.45

Tested by

no test coverage detected