Struct evm::Memory[][src]

pub struct Memory { /* fields omitted */ }
Expand description

A sequencial memory. It uses Rust’s Vec for internal representation.

Implementations

impl Memory[src]

pub fn new(limit: usize) -> Memory[src]

Create a new memory with the given limit.

pub fn limit(&self) -> usize[src]

Memory limit.

pub fn len(&self) -> usize[src]

Get the length of the current memory range.

pub fn effective_len(&self) -> U256[src]

Get the effective length.

pub fn is_empty(&self) -> bool[src]

Return true if current effective memory range is zero.

pub fn data(&self) -> &Vec<u8, Global>[src]

Return the full memory.

pub fn resize_offset(
    &mut self,
    offset: U256,
    len: U256
) -> Result<(), ExitError>
[src]

Resize the memory, making it cover the memory region of offset..(offset + len), with 32 bytes as the step. If the length is zero, this function does nothing.

pub fn resize_end(&mut self, end: U256) -> Result<(), ExitError>[src]

Resize the memory, making it cover to end, with 32 bytes as the step.

pub fn get(&self, offset: usize, size: usize) -> Vec<u8, Global>[src]

Get memory region at given offset.

Panics

Value of size is considered trusted. If they’re too large, the program can run out of memory, or it can overflow.

pub fn set(
    &mut self,
    offset: usize,
    value: &[u8],
    target_size: Option<usize>
) -> Result<(), ExitFatal>
[src]

Set memory region at given offset. The offset and value is considered untrusted.

pub fn copy_large(
    &mut self,
    memory_offset: U256,
    data_offset: U256,
    len: U256,
    data: &[u8]
) -> Result<(), ExitFatal>
[src]

Copy data into the memory, of given len.

Trait Implementations

impl Clone for Memory[src]

pub fn clone(&self) -> Memory[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Memory[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl RefUnwindSafe for Memory

impl Send for Memory

impl Sync for Memory

impl Unpin for Memory

impl UnwindSafe for Memory

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T> MaybeDebug for T where
    T: Debug