A Wasmtime engine is the runtime state and compiled-code execution context created from a Wasmtime configuration. In a component host, it represents Wasmtime itself: configure it first, then use the engine to create stores, load components, and initialize linking. section 3.4.2
A component host uses the engine as the shared runtime context for:
- Enabling the Wasm component model through Config. section 3.4.2
- Creating a Store that holds component-related runtime state. section 3.4.2
- Loading a Component and creating a Linker against the same engine. section 3.4.2
Creating an engine for a component host
Create a default configuration, enable component support, and construct the engine: let mut config = wasmtime::Config::default(); config.wasm_component_model(true); let engine = wasmtime::Engine::new(&config).unwrap();
