1 #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 #![cfg(target_os = "macos")] 3 use objc::{self, msg_send, sel, sel_impl, class}; 4 #[allow(non_camel_case_types)] 5 pub type id = *mut objc::runtime::Object; 6 pub trait PSomeProtocol: Sized + std::ops::Deref { protocolMethod(&self) where <Self as std::ops::Deref>::Target: objc::Message + Sized,7 unsafe fn protocolMethod(&self) 8 where 9 <Self as std::ops::Deref>::Target: objc::Message + Sized, 10 { 11 msg_send!(* self, protocolMethod) 12 } protocolClassMethod() where <Self as std::ops::Deref>::Target: objc::Message + Sized,13 unsafe fn protocolClassMethod() 14 where 15 <Self as std::ops::Deref>::Target: objc::Message + Sized, 16 { 17 msg_send!(class!(SomeProtocol), protocolClassMethod) 18 } 19 } 20 #[repr(transparent)] 21 #[derive(Debug, Copy, Clone)] 22 pub struct AllowlistMe(pub id); 23 impl std::ops::Deref for AllowlistMe { 24 type Target = objc::runtime::Object; deref(&self) -> &Self::Target25 fn deref(&self) -> &Self::Target { 26 unsafe { &*self.0 } 27 } 28 } 29 unsafe impl objc::Message for AllowlistMe {} 30 impl AllowlistMe { alloc() -> Self31 pub fn alloc() -> Self { 32 Self(unsafe { msg_send!(class!(AllowlistMe), alloc) }) 33 } 34 } 35 impl PSomeProtocol for AllowlistMe {} 36 impl IAllowlistMe for AllowlistMe {} 37 pub trait IAllowlistMe: Sized + std::ops::Deref { method(&self) where <Self as std::ops::Deref>::Target: objc::Message + Sized,38 unsafe fn method(&self) 39 where 40 <Self as std::ops::Deref>::Target: objc::Message + Sized, 41 { 42 msg_send!(* self, method) 43 } classMethod() where <Self as std::ops::Deref>::Target: objc::Message + Sized,44 unsafe fn classMethod() 45 where 46 <Self as std::ops::Deref>::Target: objc::Message + Sized, 47 { 48 msg_send!(class!(AllowlistMe), classMethod) 49 } 50 } 51 impl AllowlistMe_InterestingCategory for AllowlistMe {} 52 pub trait AllowlistMe_InterestingCategory: Sized + std::ops::Deref {} 53