1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use objc2::msg_send;
use objc2::rc::{Id, Shared};
use crate::{NSObject, NSString};
object! {
unsafe pub struct NSProcessInfo: NSObject;
}
unsafe impl Send for NSProcessInfo {}
unsafe impl Sync for NSProcessInfo {}
impl NSProcessInfo {
pub fn process_info() -> Id<NSProcessInfo, Shared> {
let obj: *mut Self = unsafe { msg_send![Self::class(), processInfo] };
unsafe { Id::retain_autoreleased(obj).unwrap() }
}
pub fn process_name(&self) -> Id<NSString, Shared> {
let obj: *mut NSString = unsafe { msg_send![Self::class(), processName] };
unsafe { Id::retain_autoreleased(obj).unwrap() }
}
}