Macro memory_addr::addr_range

source ·
macro_rules! addr_range {
    ($range:expr) => { ... };
}
Expand description

Converts the given range expression into AddrRange. Panics if the range is invalid.

The concrete address type is inferred from the context.

§Example

use memory_addr::{addr_range, AddrRange};

let range: AddrRange<usize> = addr_range!(0x1000usize..0x2000);
assert_eq!(range.start, 0x1000usize);
assert_eq!(range.end, 0x2000usize);

And this will panic:

let _: AddrRange<usize> = addr_range!(0x2000usize..0x1000);