Struct polkavm_linker::ProgramBlob

source ·
pub struct ProgramBlob { /* private fields */ }
Expand description

A partially deserialized PolkaVM program.

Implementations§

source§

impl ProgramBlob

source

pub fn parse(bytes: ArcBytes) -> Result<ProgramBlob, ProgramParseError>

Parses the given bytes into a program blob.

source

pub fn from_parts(parts: ProgramParts) -> Result<ProgramBlob, ProgramParseError>

Creates a program blob from parts.

source

pub fn ro_data(&self) -> &[u8]

Returns the contents of the read-only data section.

This only covers the initial non-zero portion of the section; use ro_data_size to get the full size.

source

pub fn ro_data_size(&self) -> u32

Returns the size of the read-only data section.

This can be larger than the length of ro_data, in which case the rest of the space is assumed to be filled with zeros.

source

pub fn rw_data(&self) -> &[u8]

Returns the contents of the read-write data section.

This only covers the initial non-zero portion of the section; use rw_data_size to get the full size.

source

pub fn rw_data_size(&self) -> u32

Returns the size of the read-write data section.

This can be larger than the length of rw_data, in which case the rest of the space is assumed to be filled with zeros.

source

pub fn stack_size(&self) -> u32

Returns the initial size of the stack.

source

pub fn code(&self) -> &[u8]

Returns the program code in its raw form.

source

pub fn bitmask(&self) -> &[u8]

Returns the code bitmask in its raw form.

source

pub fn imports(&self) -> Imports<'_>

source

pub fn exports(&self) -> impl Iterator<Item = ProgramExport<&[u8]>> + Clone

Returns an iterator over program exports.

source

pub fn instructions(&self) -> Instructions<'_>

source

pub fn instructions_at( &self, offset: ProgramCounter, ) -> Option<Instructions<'_>>

source

pub fn jump_table(&self) -> JumpTable<'_>

Returns a jump table.

source

pub fn get_debug_string(&self, offset: u32) -> Result<&str, ProgramParseError>

Returns the debug string for the given relative offset.

source

pub fn get_debug_line_program_at( &self, program_counter: ProgramCounter, ) -> Result<Option<LineProgram<'_>>, ProgramParseError>

Returns the line program for the given instruction.

Trait Implementations§

source§

impl Clone for ProgramBlob

source§

fn clone(&self) -> ProgramBlob

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for ProgramBlob

source§

fn default() -> ProgramBlob

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.