idalib/
processor.rs

1use std::marker::PhantomData;
2
3use crate::ffi::processor::*;
4use crate::idb::IDB;
5
6pub use crate::ffi::processor::ids as id;
7
8pub struct Processor<'a> {
9    ptr: *const processor_t,
10    _marker: PhantomData<&'a IDB>,
11}
12
13pub type ProcessorId = i32;
14
15impl<'a> Processor<'a> {
16    pub(crate) fn from_ptr(ptr: *const processor_t) -> Self {
17        Self {
18            ptr,
19            _marker: PhantomData,
20        }
21    }
22
23    pub fn id(&self) -> ProcessorId {
24        unsafe { idalib_ph_id(self.ptr) }
25    }
26
27    pub fn long_name(&self) -> String {
28        unsafe { idalib_ph_long_name(self.ptr) }
29    }
30
31    pub fn short_name(&self) -> String {
32        unsafe { idalib_ph_short_name(self.ptr) }
33    }
34}