pub trait MemoryController {
type Handle: MemoryHandle + Copy + Clone;
type AllocationInfoType: AllocationInfo<Self>;
// Required methods
unsafe fn get_symbol_address(
&self,
module: Option<&CStr>,
symbol: &CStr,
) -> Result<NonNull<c_void>>;
unsafe fn allocate_memory(
&self,
min_size: Option<usize>,
) -> Result<Self::AllocationInfoType>;
unsafe fn set_page_protection(
&self,
handle: Self::Handle,
size: usize,
protection: MemoryProtection,
) -> Result<()>;
fn protection_guard_for_page<'a>(
&'a self,
ptr: NonNull<c_void>,
on_enter: MemoryProtection,
on_exit: Option<MemoryProtection>,
) -> Result<MemoryProtectionGuard<'a, Self>>
where Self: Sized;
// Provided method
fn protection_guard<'a>(
&'a self,
memory_start: Self::Handle,
memory_size: usize,
on_enter: MemoryProtection,
on_exit: MemoryProtection,
) -> Result<MemoryProtectionGuard<'a, Self>>
where Self: Sized { ... }
}Required Associated Types§
type Handle: MemoryHandle + Copy + Clone
type AllocationInfoType: AllocationInfo<Self>
Required Methods§
unsafe fn get_symbol_address( &self, module: Option<&CStr>, symbol: &CStr, ) -> Result<NonNull<c_void>>
unsafe fn allocate_memory( &self, min_size: Option<usize>, ) -> Result<Self::AllocationInfoType>
unsafe fn set_page_protection( &self, handle: Self::Handle, size: usize, protection: MemoryProtection, ) -> Result<()>
fn protection_guard_for_page<'a>(
&'a self,
ptr: NonNull<c_void>,
on_enter: MemoryProtection,
on_exit: Option<MemoryProtection>,
) -> Result<MemoryProtectionGuard<'a, Self>>where
Self: Sized,
Provided Methods§
fn protection_guard<'a>(
&'a self,
memory_start: Self::Handle,
memory_size: usize,
on_enter: MemoryProtection,
on_exit: MemoryProtection,
) -> Result<MemoryProtectionGuard<'a, Self>>where
Self: Sized,
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.