Crate soroban_env_host
source ·Expand description
This crate mainly exists to provide the Soroban Host type, which is the implementation of the Env interface between guest contract code and the host it runs within.
This crate also re-exports all of the content of the soroban_env_common crate for use by host (or contract local-testing) code. Most of the type and module definitions visible here are actually defined in the common crate.
The Host
can be configured with or without support for a vm::Vm,
depending on the "vm"
cargo feature. When enabled, the VM is currently a
thin wrapper around the wasmi
interpreter, though other VMs might be supported in the future.
It may seem unusual to configure a contract host without a VM, but this
configuration makes more sense when considering that Soroban supports a
“local testing” configuration where host and guest code are both compiled
natively and linked together for a faster and richer debugging and testing
experience. When testing this way, developers may also wish to enable the
"testutils"
feature, which enables an interface on Host for registering
other test contracts by ID.
The Host type provides some facilities above and beyond just the Env trait, including:
Re-exports
pub use vm::Vm;
Modules
Macros
Structs
a-zA-Z0-9_
alphabet encoded into a 60-bit space between 10 characters long.unimplemented!()
in
all functions. Useful for certain testing scenarios.Enums
Constants
Traits
core::cmp::Cmp
but with two key differences: the comparison is
fallible, and is provided by some external type implementing Compare
rather than the compared type itself.