Expand description
The interface between the host and guest is implemented as an HdkT
trait.
The set_hdk
function globally sets a RefCell
to track the current HDK implementation.
When the mock
feature is set then this will default to an HDK 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 Hdk is registered. Generally only useful for testing but technically can be set any time.
The HDK implemented as externs provided by the host.
Constants
Traits
When mocking is enabled the mockall crate automatically builds a MockHdkT for us.
Functions
At any time the global HDK can be set to a different hdk.
Generally this is only useful during rust unit testing.
When executing wasm without the mock
feature, the host will be assumed.