pub struct Instructions { /* private fields */ }

Implementations§

source§

impl Instructions

source

pub fn create() -> Result<Self, InstructionsError>

create Instructions

§Panics

Panics if OOM (out of memory) and panic_flag is set to true

§Errors InstructionsError::AllocationFailed

This function will return an error if panic_flag is set to false and OOM occured

source

pub fn to_string_with_highlight(&self, hidx: usize) -> String

Stringify this Instructions

  • hidx - index of highlight target
source

pub fn add_instruction( &mut self, ins: Instruction ) -> Result<usize, InstructionsError>

Add new instruction at the end. return new Instruction’s offset

§Errors InstructionsError

This function will return an error if this Instructions::grow() have failed.

source

pub unsafe fn update_instruction(&mut self, ins: Instruction, offset: usize)

Update instruction at offset with given ins

§Safety

if lengths are different between ins and instruction at offset, There will be Corruption of this Instructions

source

pub fn remove_instruction(&mut self, new_len: usize)

Remove instructions by set Self::len with new_len

This will move Self::cursor with new position of next instruction’s one

source

pub fn read_instruction( &self, offset: usize ) -> Result<Instruction, InstructionsError>

Read Instruction at given offset

§Errors InstructionsError::CannotRead

This function will return an error if failed to read opcode from Self::byte at offset to convert it as Instruction

source

pub fn length(&self) -> usize

Returns the length of this Instructions.

Trait Implementations§

source§

impl Clone for Instructions

source§

fn clone(&self) -> Instructions

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 Debug for Instructions

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Instructions

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for Instructions

source§

fn eq(&self, other: &Instructions) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Instructions

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> 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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.