pub struct MemoryState { /* private fields */ }Expand description
Memory state management
Implementations§
Source§impl MemoryState
impl MemoryState
Sourcepub fn with_limit(max_memory_usage: usize) -> Self
pub fn with_limit(max_memory_usage: usize) -> Self
Create a new memory state with memory limit
§Arguments
max_memory_usage- Maximum allowed memory usage in bytes
Sourcepub fn write_memory(&mut self, address: u64, data: &[u8]) -> JitResult<()>
pub fn write_memory(&mut self, address: u64, data: &[u8]) -> JitResult<()>
Write memory to a specific address
§Arguments
address- Starting address to write todata- Data to write
Sourcepub fn allocate_region(
&mut self,
address: u64,
size: usize,
label: Option<String>,
) -> JitResult<u64>
pub fn allocate_region( &mut self, address: u64, size: usize, label: Option<String>, ) -> JitResult<u64>
Sourcepub fn deallocate_region(&mut self, allocation_id: u64) -> JitResult<()>
pub fn deallocate_region(&mut self, allocation_id: u64) -> JitResult<()>
Sourcepub fn get_allocated_regions(&self) -> Vec<&MemoryRegion>
pub fn get_allocated_regions(&self) -> Vec<&MemoryRegion>
Get information about all allocated regions
Sourcepub fn find_region_containing(&self, address: u64) -> Option<&MemoryRegion>
pub fn find_region_containing(&self, address: u64) -> Option<&MemoryRegion>
Sourcepub fn get_memory_stats(&self) -> MemoryStats
pub fn get_memory_stats(&self) -> MemoryStats
Get memory usage statistics
Sourcepub fn set_memory_limit(&mut self, limit: usize)
pub fn set_memory_limit(&mut self, limit: usize)
Set memory limit
Sourcepub fn memory_limit(&self) -> usize
pub fn memory_limit(&self) -> usize
Get memory limit
Trait Implementations§
Source§impl Clone for MemoryState
impl Clone for MemoryState
Source§fn clone(&self) -> MemoryState
fn clone(&self) -> MemoryState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryState
impl Debug for MemoryState
Auto Trait Implementations§
impl Freeze for MemoryState
impl RefUnwindSafe for MemoryState
impl Send for MemoryState
impl Sync for MemoryState
impl Unpin for MemoryState
impl UnsafeUnpin for MemoryState
impl UnwindSafe for MemoryState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more