Skip to main content

frida_rs/plumbing/
nativepointer.rs

1use std::fmt;
2use wasm_bindgen::prelude::*;
3
4#[wasm_bindgen]
5extern "C" {
6    ///Wrapper for a pointer on the instrumented target.
7    ///
8    ///This is equivalent to the `NativePointer` class in the JavaScript API.
9    #[wasm_bindgen(js_name = NativePointer)]
10    #[derive(Debug)]
11    pub type NativePointer;
12
13    #[wasm_bindgen(constructor)]
14    pub fn new(s: &str) -> NativePointer;
15
16    #[wasm_bindgen(constructor)]
17    pub fn from_i32(s: i32) -> NativePointer;
18
19    #[wasm_bindgen(method, js_name = readU8)]
20    pub fn read_u8(this: &NativePointer) -> u8;
21
22    #[wasm_bindgen(method, js_name = toString)]
23    pub fn to_string(this: &NativePointer) -> String;
24}
25
26impl fmt::Display for NativePointer {
27    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
28        write!(f, "{}", self.to_string())
29    }
30}