pub trait StateRead {
type Error: Debug + Display;
type Future: Future<Output = Result<Vec<Vec<i64>>, Self::Error>> + Unpin;
// Required method
fn key_range(
&self,
contract_addr: ContentAddress,
key: Vec<i64>,
num_values: usize,
) -> Self::Future;
}
Expand description
Access to state required by the state read VM.
Required Associated Types§
Sourcetype Error: Debug + Display
type Error: Debug + Display
An error type describing any cases that might occur during state reading.
Sourcetype Future: Future<Output = Result<Vec<Vec<i64>>, Self::Error>> + Unpin
type Future: Future<Output = Result<Vec<Vec<i64>>, Self::Error>> + Unpin
The future type returned from the key_range
method.
§Unpin
This Future
must be Unpin
in order for the Vm
’s ExecFuture
to remain zero-allocation by default. Implementers may decide on
whether they require dynamic allocation as a part of their StateRead
implementation.
It is likely that in-memory implementations may be Unpin
by default
using std::future::Ready
, however more involved implementations that
require calling async
functions with anonymised return types may
require using a Box
in order to name the anonymised type.