pub trait MemoryTr {
// Required methods
fn set_data(
&mut self,
memory_offset: usize,
data_offset: usize,
len: usize,
data: &[u8],
);
fn set_data_from_global(
&mut self,
memory_offset: usize,
data_offset: usize,
len: usize,
data_range: Range<usize>,
);
fn global_slice(&self, range: Range<usize>) -> Ref<'_, [u8]>;
fn local_memory_offset(&self) -> usize;
fn set(&mut self, memory_offset: usize, data: &[u8]);
fn size(&self) -> usize;
fn copy(&mut self, destination: usize, source: usize, len: usize);
fn slice(&self, range: Range<usize>) -> Ref<'_, [u8]>;
fn resize(&mut self, new_size: usize) -> bool;
// Provided method
fn slice_len(
&self,
offset: usize,
len: usize,
) -> impl Deref<Target = [u8]> + '_ { ... }
}
Expand description
Trait for Interpreter memory operations.
Required Methods§
Sourcefn set_data(
&mut self,
memory_offset: usize,
data_offset: usize,
len: usize,
data: &[u8],
)
fn set_data( &mut self, memory_offset: usize, data_offset: usize, len: usize, data: &[u8], )
Sets memory data at given offset from data with a given data_offset and len.
§Panics
Panics if range is out of scope of allocated memory.
Sourcefn set_data_from_global(
&mut self,
memory_offset: usize,
data_offset: usize,
len: usize,
data_range: Range<usize>,
)
fn set_data_from_global( &mut self, memory_offset: usize, data_offset: usize, len: usize, data_range: Range<usize>, )
Inner clone part of memory from global context to local context. This is used to clone calldata to memory.
§Panics
Panics if range is out of scope of allocated memory.
Sourcefn global_slice(&self, range: Range<usize>) -> Ref<'_, [u8]>
fn global_slice(&self, range: Range<usize>) -> Ref<'_, [u8]>
Memory slice with global range. This range
§Panics
Panics if range is out of scope of allocated memory.
Sourcefn local_memory_offset(&self) -> usize
fn local_memory_offset(&self) -> usize
Offset of local context of memory.
Sourcefn copy(&mut self, destination: usize, source: usize, len: usize)
fn copy(&mut self, destination: usize, source: usize, len: usize)
Copies memory data from source to destination.
§Panics
Panics if range is out of scope of allocated memory.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.