pub struct Memory { /* private fields */ }
Expand description
A sequencial memory. It uses Rust’s Vec
for internal
representation.
Implementations§
source§impl Memory
impl Memory
sourcepub fn effective_len(&self) -> U256
pub fn effective_len(&self) -> U256
Get the effective length.
sourcepub fn resize_offset(
&mut self,
offset: U256,
len: U256
) -> Result<(), ExitError>
pub fn resize_offset( &mut self, offset: U256, len: U256 ) -> Result<(), ExitError>
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.
sourcepub fn resize_end(&mut self, end: U256) -> Result<(), ExitError>
pub fn resize_end(&mut self, end: U256) -> Result<(), ExitError>
Resize the memory, making it cover to end
, with 32 bytes as the step.
sourcepub fn get(&self, offset: usize, size: usize) -> Vec<u8>
pub fn get(&self, offset: usize, size: usize) -> Vec<u8>
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.
Trait Implementations§
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more