Module hdi::hdi

source · []
Expand description

The interface between the host and guest is implemented as an HdiT trait.

The set_hdi function globally sets a RefCell to track the current HDI implementation. When the mock feature is set then this will default to an HDI that always errors, else a WASM host is assumed to exist. The mockall crate (in prelude with mock feature) can be used to generate compatible mocks for unit testing. See mocking examples in the test WASMs crate, such as agent_info.

Structs

Used as a placeholder before any other Hdi is registered. Generally only useful for testing but technically can be set any time.
The HDI implemented as externs provided by the host.

Constants

Traits

When mocking is enabled the mockall crate automatically builds a MockHdiT for us.

Functions

At any time the global HDI can be set to a different HDI. Generally this is only useful during rust unit testing. When executing wasm without the mock feature, the host will be assumed.