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

Method load_code_raw

crates/wasmtime/src/engine.rs:912–920  ·  view source on GitHub ↗

Loads a `CodeMemory` from the specified memory region without copying The `expected` marker here is whether the bytes are expected to be a precompiled module or a component. The `memory` provided is expected to be a serialized module (.cwasm) generated by `[Module::serialize]` or [`Engine::precompile_module] or their `Component` counterparts [`Component::serialize`] or `[Engine::precompile_compo

(
        &self,
        memory: NonNull<[u8]>,
        expected: ObjectKind,
    )

Source from the content-addressed store, hash-verified

910 /// of the provided memory. As such, outside writes to this memory region
911 /// will result in undefined and likely very undesirable behavior.
912 pub(crate) unsafe fn load_code_raw(
913 &self,
914 memory: NonNull<[u8]>,
915 expected: ObjectKind,
916 ) -> Result<Arc<crate::CodeMemory>> {
917 // SAFETY: the contract of this function is the same as that of
918 // `from_raw`.
919 unsafe { self.load_code(crate::runtime::vm::MmapVec::from_raw(memory)?, expected) }
920 }
921
922 /// Like `load_code_bytes`, but creates a mmap from a file on disk.
923 #[cfg(feature = "std")]

Callers 2

deserialize_rawMethod · 0.80
deserialize_rawMethod · 0.80

Calls 1

load_codeMethod · 0.80

Tested by

no test coverage detected