pub trait OuterVm {
type InnerVm: InnerVm;
// Required methods
fn export(&mut self, segment: &[u8; 4104]) -> Result<(), ApiError>;
fn read_file_block(&mut self, block_ref: &BlockRef) -> Option<Bytes>;
fn machine(
&mut self,
code: &[u8],
program_counter: u64,
) -> Result<Self::InnerVm, ApiError>;
// Provided methods
fn read_file(&mut self, block_ref: &BlockRef) -> Result<Vec<u8>, Error> { ... }
fn block_reader(&mut self) -> Lookup<'_, Self> { ... }
}Expand description
A trait that abstracts JAM host-calls available in a refine environment and related to an outer VM.
Required Associated Types§
Required Methods§
Sourcefn export(&mut self, segment: &[u8; 4104]) -> Result<(), ApiError>
fn export(&mut self, segment: &[u8; 4104]) -> Result<(), ApiError>
Export segment from the work package.
The segment length must not be longer than SEGMENT_LEN.
If it’s shorter, the rest of of the bytes are zeroed.
Sourcefn read_file_block(&mut self, block_ref: &BlockRef) -> Option<Bytes>
fn read_file_block(&mut self, block_ref: &BlockRef) -> Option<Bytes>
Reads file system block specified by its reference.
Provided Methods§
Sourcefn read_file(&mut self, block_ref: &BlockRef) -> Result<Vec<u8>, Error>
fn read_file(&mut self, block_ref: &BlockRef) -> Result<Vec<u8>, Error>
Returns the contents of a file specified by its main block reference.
Uses read_file_block to read file blocks.
Sourcefn block_reader(&mut self) -> Lookup<'_, Self>
fn block_reader(&mut self) -> Lookup<'_, Self>
Returns file system block reader that uses read_file_block to
read file blocks.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".