pub trait OuterVm {
type InnerVm: InnerVm;
// Required methods
fn get_imported_page(&mut self, address: u64) -> Option<Segment>;
fn export(&mut self, segment: &[u8]) -> Result<(), ApiError>;
fn read_file_block(&mut self, block_ref: &BlockRef) -> Option<Bytes>;
fn get_export_count(&mut self) -> u16;
fn get_auth_output_len(&mut self) -> u32;
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 get_imported_page(&mut self, address: u64) -> Option<Segment>
fn get_imported_page(&mut self, address: u64) -> Option<Segment>
Returns a memory page with the specified address that was imported into work package or
None if such page doesn’t exist.
Sourcefn export(&mut self, segment: &[u8]) -> Result<(), ApiError>
fn export(&mut self, segment: &[u8]) -> 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.
Sourcefn get_export_count(&mut self) -> u16
fn get_export_count(&mut self) -> u16
Returns the number of exports that the current work package has.
Sourcefn get_auth_output_len(&mut self) -> u32
fn get_auth_output_len(&mut self) -> u32
Returns the length of the authorizer output.
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", so this trait is not object safe.