Struct dynasmrt::components::MemoryManager
source · pub struct MemoryManager { /* private fields */ }
Expand description
This struct implements a protection-swapping assembling buffer
Implementations§
source§impl MemoryManager
impl MemoryManager
sourcepub fn new(initial_mmap_size: usize) -> Result<Self>
pub fn new(initial_mmap_size: usize) -> Result<Self>
Create a new memory manager, with initial_mmap_size
data allocated
sourcepub fn execbuffer_addr(&self) -> usize
pub fn execbuffer_addr(&self) -> usize
Returns the current start address of the managed executable memory
sourcepub fn commit<F>(&mut self, new: &mut Vec<u8>, f: F)
pub fn commit<F>(&mut self, new: &mut Vec<u8>, f: F)
Commits the data from new
into the managed memory, calling f
when the buffer is moved to fix anything
that relies on the address of the buffer
sourcepub fn write(&self) -> RwLockWriteGuard<'_, ExecutableBuffer>
pub fn write(&self) -> RwLockWriteGuard<'_, ExecutableBuffer>
Borrow the internal memory buffer mutably
sourcepub fn finalize(self) -> Result<ExecutableBuffer, Self>
pub fn finalize(self) -> Result<ExecutableBuffer, Self>
Finalizes the currently committed part of the buffer.
sourcepub fn reader(&self) -> Arc<RwLock<ExecutableBuffer>>
pub fn reader(&self) -> Arc<RwLock<ExecutableBuffer>>
Create an atomically refcounted reference to the internal executable buffer
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MemoryManager
impl RefUnwindSafe for MemoryManager
impl Send for MemoryManager
impl Sync for MemoryManager
impl Unpin for MemoryManager
impl UnwindSafe for MemoryManager
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