[][src]Struct evm::Memory

pub struct Memory { /* fields omitted */ }

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 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>[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]

impl Debug for Memory[src]

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]

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

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

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

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

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.

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.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,