region
A Rust library for dealing with memory regions.
It is implemented using platform specific APIs (e.g VirtualQuery,
VirtualLock, mprotect, mlock).
Platforms
This library provides CI for the following targets:
- Linux
aarch64-linux-androidarmv7-unknown-linux-gnueabihfi686-unknown-linux-gnux86_64-unknown-linux-gnu
- Windows
x86_64-pc-windows-gnux86_64-pc-windows-msvc
- macOS
x86_64-apple-darwin
- FreeBSD
x86_64-unknown-freebsd
Installation
Add this to your Cargo.toml:
[]
= "2.2.0"
and this to your crate root:
extern crate region;
Example
- Cross-platform equivalents:
let data = ;
// Page size
let pz = size;
let pc = ceil;
let pf = floor;
// VirtualQuery | '/proc/self/maps'
let q = query?;
let qr = query_range?;
// VirtualProtect | mprotect
protect?;
// ... you can also temporarily change a region's protection
let handle = protect_with_handle?;
// VirtualLock | mlock
let guard = lock?;