1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#[macro_use]
extern crate cfg_if;
extern crate libc;
pub mod slice;
pub mod error;
cfg_if! {
if #[cfg(target_os = "macos")] {
pub mod mac;
pub use mac::MemReader;
} else if #[cfg(target_os = "linux")] {
pub mod linux;
pub use linux::MemReader;
} else if #[cfg(target_os = "windows")] {
pub mod windows;
pub use windows::MemReader;
} else {
panic!("Unsupported system");
}
}
use slice::MemorySlice;
use error::*;
trait ReadsMemory {
fn read_bytes(&self, address: usize, n: usize) -> Result<Vec<u8>>;
}
pub trait ProvidesSlices {
fn address_slice(&self, start: usize, end: usize) -> MemorySlice;
fn address_slice_len(&self, start: usize, n: usize) -> MemorySlice;
}