1 stable release
| 30.0.0 | Dec 27, 2025 |
|---|
#3 in #pezsp
663 downloads per month
Used in 362 crates
(158 directly)
1MB
24K
SLoC
I/O host interface for Bizinikiwi runtime.
License: Apache-2.0
lib.rs:
Bizinikiwi Primitives: IO
This crate contains interfaces for the runtime to communicate with the outside world, ergo io.
In other context, such interfaces are referred to as "host functions".
Each set of host functions are defined with an instance of the
pezsp_runtime_interface::runtime_interface macro.
Most notably, this crate contains host functions for:
All of the default host functions provided by this crate, and by default contained in all
bizinikiwi-based clients are amalgamated in BizinikiwiHostFunctions.
Externalities
Host functions go hand in hand with the concept of externalities. Externalities are an environment in which host functions are provided, and thus can be accessed. Some host functions are only accessible in an externality environment that provides it.
A typical error for bizinikiwi developers is the following:
use pezsp_io::storage::get;
let data = get(b"hello world");
This code will panic with the following error:
thread 'main' panicked at '`get_version_1` called outside of an Externalities-provided environment.'
Such error messages should always be interpreted as "code accessing host functions accessed outside of externalities".
An externality is any type that implements pezsp_externalities::Externalities. A simple
example of which is TestExternalities, which is commonly used in tests and is exported from
this crate.
use pezsp_io::{storage::get, TestExternalities};
TestExternalities::default().execute_with(|| {
let data = get(b"hello world");
});
Dependencies
~25–47MB
~670K SLoC