pub struct WasmBackend { /* private fields */ }Expand description
Loads Wasm without WASI or host imports. 在没有 WASI 和宿主导入的环境中加载 Wasm。
Implementations§
Source§impl WasmBackend
impl WasmBackend
Sourcepub const fn new(limits: WasmLimits) -> Self
pub const fn new(limits: WasmLimits) -> Self
Build a backend that applies limits to every loaded instance.
构造一个对每个已加载实例施加 limits 的后端。
Sourcepub fn load(
&self,
artifact: VerifiedPluginArtifact,
) -> Result<WasmInstance, HostError>
pub fn load( &self, artifact: VerifiedPluginArtifact, ) -> Result<WasmInstance, HostError>
Compile and instantiate the artifact, checking the limits, the host ABI version
when the plugin exports one (a missing nichlink_abi_version is a legacy
plugin, as README.md says), and the nichlink_health export.
编译并实例化工件,检查各项上限、宿主 ABI 版本(当插件导出它时;缺少
nichlink_abi_version 的是旧插件,见 README.md)以及 nichlink_health 导出。
This performs no slot policy: channel, framework, mode and flow are checked by
WasmPluginTable::install and
validate_artifact. A host that calls the backend directly gets the wasm limits
and nothing else.
本方法不做槽位策略:通道、框架、模式与 flow 由
WasmPluginTable::install 与 validate_artifact
检查。直接调用后端的宿主只得到 wasm 上限,别的什么都没有。