xur_

> built-in type

ptr

methods of ptr values

in the browser

A ptr is a raw 64-bit address. It prints in hex, and adding or subtracting an integer with + and - moves it by that many bytes. std::ptr makes pointers, and pointer values have the methods below. None of them read or write memory; see xur.std.mem(7) for that.

> methods

# ptr.is_null() -> bool

Whether the address is 0.

# ptr.offset(n: i64) -> ptr

The pointer moved by n bytes, which may be negative. The address wraps around instead of failing.

# ptr.to_hex() -> str

The address as lowercase hex with a 0x prefix and no padding: "0x1000".

# ptr.to_int() -> i64

The address as an integer. An address above the largest i64 comes back as an unsigned 64-bit integer rather than a negative one.

> examples

use std::ptr;
use std::io;

fn main() {
    let p = ptr::from_int(0x1000);
    io::println("addr: {}", p.offset(16).to_hex());
    io::println("null? {}", ptr::null().is_null());
}