pub struct MapRange {
    pub offset: usize,
    pub dev: String,
    pub flags: String,
    pub inode: usize,
    /* private fields */
}
Expand description

A struct representing a single virtual memory region.

While this structure is only for Linux, the macOS, Windows, and FreeBSD variants have identical exposed methods

Fields§

§offset: usize§dev: String§flags: String§inode: usize

Implementations§

source§

impl MapRange

source

pub fn size(&self) -> usize

Returns the size of this MapRange in bytes

Examples found in repository?
examples/print_maps.rs (line 18)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
fn main() {
    let args: Vec<String> = std::env::args().collect();

    let pid = if args.len() > 1 {
        args[1].parse().expect("invalid pid")
    } else {
        panic!("Usage: print_maps PID");
    };

    let maps = proc_maps::get_process_maps(pid).expect("failed to get proc maps");
    for map in maps {
        println!(
            "Filename {:?} Address {} Size {}",
            map.filename(),
            map.start(),
            map.size()
        );
    }
}
source

pub fn start(&self) -> usize

Returns the address this MapRange starts at

Examples found in repository?
examples/print_maps.rs (line 17)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
fn main() {
    let args: Vec<String> = std::env::args().collect();

    let pid = if args.len() > 1 {
        args[1].parse().expect("invalid pid")
    } else {
        panic!("Usage: print_maps PID");
    };

    let maps = proc_maps::get_process_maps(pid).expect("failed to get proc maps");
    for map in maps {
        println!(
            "Filename {:?} Address {} Size {}",
            map.filename(),
            map.start(),
            map.size()
        );
    }
}
source

pub fn filename(&self) -> Option<&Path>

Returns the filename of the loaded module

Examples found in repository?
examples/print_maps.rs (line 16)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
fn main() {
    let args: Vec<String> = std::env::args().collect();

    let pid = if args.len() > 1 {
        args[1].parse().expect("invalid pid")
    } else {
        panic!("Usage: print_maps PID");
    };

    let maps = proc_maps::get_process_maps(pid).expect("failed to get proc maps");
    for map in maps {
        println!(
            "Filename {:?} Address {} Size {}",
            map.filename(),
            map.start(),
            map.size()
        );
    }
}
source

pub fn is_exec(&self) -> bool

Returns whether this range contains executable code

source

pub fn is_write(&self) -> bool

Returns whether this range contains writeable memory

source

pub fn is_read(&self) -> bool

Returns whether this range contains readable memory

Trait Implementations§

source§

impl Clone for MapRange

source§

fn clone(&self) -> MapRange

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for MapRange

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<MapRange> for MapRange

source§

fn eq(&self, other: &MapRange) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for MapRange

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.