Function region::query_range [] [src]

pub fn query_range(address: *const u8,
                   size: usize)
                   -> Result<Vec<Region>, Error>

Queries the OS with a range, returning the regions it contains.

The range is from address (inclusive) to address + size (exclusive). Therefore a 2-byte range straddling a page boundary will return both pages (or one region, if the pages have the same properties). The implementation uses query internally.

  • The address is rounded down to the closest page boundary.
  • The address may not be null.

Examples

let data = [0; 100];
let region = region::query_range(data.as_ptr(), data.len()).unwrap();

assert!(region.len() > 0);