1use core::fmt;
4use core::hash;
5
6use crate::runtime::{AnyClass, AnyObject, NSObjectProtocol, ProtocolObject};
7use crate::{extern_conformance, AnyThread, ClassType, DowncastTarget};
8
9#[repr(C)]
16pub struct NSProxy {
17 __superclass: AnyObject,
18}
19
20crate::__extern_class_impl_traits! {
21 ()
22 (unsafe impl)
23 (NSProxy)
24 (AnyObject)
25}
26
27unsafe impl ClassType for NSProxy {
28 type Super = AnyObject;
29 type ThreadKind = dyn AnyThread;
30 const NAME: &'static str = "NSProxy";
31
32 #[inline]
33 fn class() -> &'static AnyClass {
34 crate::__class_inner!("NSProxy", "NSProxy")
35 }
36
37 #[inline]
38 fn as_super(&self) -> &Self::Super {
39 &self.__superclass
40 }
41
42 const __INNER: () = ();
43
44 type __SubclassingType = Self;
47}
48
49unsafe impl DowncastTarget for NSProxy {}
50
51extern_conformance!(
52 unsafe impl NSObjectProtocol for NSProxy {}
53);
54
55impl PartialEq for NSProxy {
56 #[inline]
57 #[doc(alias = "isEqual:")]
58 fn eq(&self, other: &Self) -> bool {
59 self.isEqual(Some(other))
60 }
61}
62
63impl Eq for NSProxy {}
64
65impl hash::Hash for NSProxy {
66 #[inline]
67 fn hash<H: hash::Hasher>(&self, state: &mut H) {
68 <NSProxy as NSObjectProtocol>::hash(self).hash(state);
69 }
70}
71
72impl fmt::Debug for NSProxy {
73 #[inline]
74 #[doc(alias = "description")]
75 #[doc(alias = "debugDescription")]
76 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
77 let obj: &ProtocolObject<dyn NSObjectProtocol> = ProtocolObject::from_ref(self);
78 obj.fmt(f)
79 }
80}