objc2_foundation/generated/
NSPointerFunctions.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct NSPointerFunctionsOptions(pub NSUInteger);
14bitflags::bitflags! {
15 impl NSPointerFunctionsOptions: NSUInteger {
16 #[doc(alias = "NSPointerFunctionsStrongMemory")]
17 const StrongMemory = 0<<0;
18#[deprecated = "GC no longer supported"]
19 #[doc(alias = "NSPointerFunctionsZeroingWeakMemory")]
20 const ZeroingWeakMemory = 1<<0;
21 #[doc(alias = "NSPointerFunctionsOpaqueMemory")]
22 const OpaqueMemory = 2<<0;
23 #[doc(alias = "NSPointerFunctionsMallocMemory")]
24 const MallocMemory = 3<<0;
25 #[doc(alias = "NSPointerFunctionsMachVirtualMemory")]
26 const MachVirtualMemory = 4<<0;
27 #[doc(alias = "NSPointerFunctionsWeakMemory")]
28 const WeakMemory = 5<<0;
29 #[doc(alias = "NSPointerFunctionsObjectPersonality")]
30 const ObjectPersonality = 0<<8;
31 #[doc(alias = "NSPointerFunctionsOpaquePersonality")]
32 const OpaquePersonality = 1<<8;
33 #[doc(alias = "NSPointerFunctionsObjectPointerPersonality")]
34 const ObjectPointerPersonality = 2<<8;
35 #[doc(alias = "NSPointerFunctionsCStringPersonality")]
36 const CStringPersonality = 3<<8;
37 #[doc(alias = "NSPointerFunctionsStructPersonality")]
38 const StructPersonality = 4<<8;
39 #[doc(alias = "NSPointerFunctionsIntegerPersonality")]
40 const IntegerPersonality = 5<<8;
41 #[doc(alias = "NSPointerFunctionsCopyIn")]
42 const CopyIn = 1<<16;
43 }
44}
45
46unsafe impl Encode for NSPointerFunctionsOptions {
47 const ENCODING: Encoding = NSUInteger::ENCODING;
48}
49
50unsafe impl RefEncode for NSPointerFunctionsOptions {
51 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
52}
53
54extern_class!(
55 #[unsafe(super(NSObject))]
57 #[derive(Debug, PartialEq, Eq, Hash)]
58 pub struct NSPointerFunctions;
59);
60
61#[cfg(feature = "NSObject")]
62unsafe impl NSCopying for NSPointerFunctions {}
63
64#[cfg(feature = "NSObject")]
65unsafe impl CopyingHelper for NSPointerFunctions {
66 type Result = Self;
67}
68
69unsafe impl NSObjectProtocol for NSPointerFunctions {}
70
71impl NSPointerFunctions {
72 extern_methods!(
73 #[unsafe(method(initWithOptions:))]
74 #[unsafe(method_family = init)]
75 pub unsafe fn initWithOptions(
76 this: Allocated<Self>,
77 options: NSPointerFunctionsOptions,
78 ) -> Retained<Self>;
79
80 #[unsafe(method(pointerFunctionsWithOptions:))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn pointerFunctionsWithOptions(
83 options: NSPointerFunctionsOptions,
84 ) -> Retained<NSPointerFunctions>;
85
86 #[unsafe(method(hashFunction))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn hashFunction(
89 &self,
90 ) -> Option<
91 unsafe extern "C-unwind" fn(
92 NonNull<c_void>,
93 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
94 ) -> NSUInteger,
95 >;
96
97 #[unsafe(method(setHashFunction:))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn setHashFunction(
101 &self,
102 hash_function: Option<
103 unsafe extern "C-unwind" fn(
104 NonNull<c_void>,
105 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
106 ) -> NSUInteger,
107 >,
108 );
109
110 #[unsafe(method(isEqualFunction))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn isEqualFunction(
113 &self,
114 ) -> Option<
115 unsafe extern "C-unwind" fn(
116 NonNull<c_void>,
117 NonNull<c_void>,
118 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
119 ) -> Bool,
120 >;
121
122 #[unsafe(method(setIsEqualFunction:))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn setIsEqualFunction(
126 &self,
127 is_equal_function: Option<
128 unsafe extern "C-unwind" fn(
129 NonNull<c_void>,
130 NonNull<c_void>,
131 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
132 ) -> Bool,
133 >,
134 );
135
136 #[unsafe(method(sizeFunction))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn sizeFunction(
139 &self,
140 ) -> Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>;
141
142 #[unsafe(method(setSizeFunction:))]
144 #[unsafe(method_family = none)]
145 pub unsafe fn setSizeFunction(
146 &self,
147 size_function: Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
148 );
149
150 #[cfg(feature = "NSString")]
151 #[unsafe(method(descriptionFunction))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn descriptionFunction(
154 &self,
155 ) -> Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> *mut NSString>;
156
157 #[cfg(feature = "NSString")]
158 #[unsafe(method(setDescriptionFunction:))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn setDescriptionFunction(
162 &self,
163 description_function: Option<
164 unsafe extern "C-unwind" fn(NonNull<c_void>) -> *mut NSString,
165 >,
166 );
167
168 #[unsafe(method(relinquishFunction))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn relinquishFunction(
171 &self,
172 ) -> Option<
173 unsafe extern "C-unwind" fn(
174 NonNull<c_void>,
175 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
176 ),
177 >;
178
179 #[unsafe(method(setRelinquishFunction:))]
181 #[unsafe(method_family = none)]
182 pub unsafe fn setRelinquishFunction(
183 &self,
184 relinquish_function: Option<
185 unsafe extern "C-unwind" fn(
186 NonNull<c_void>,
187 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
188 ),
189 >,
190 );
191
192 #[unsafe(method(acquireFunction))]
193 #[unsafe(method_family = none)]
194 pub unsafe fn acquireFunction(
195 &self,
196 ) -> Option<
197 unsafe extern "C-unwind" fn(
198 NonNull<c_void>,
199 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
200 Bool,
201 ) -> NonNull<c_void>,
202 >;
203
204 #[unsafe(method(setAcquireFunction:))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn setAcquireFunction(
208 &self,
209 acquire_function: Option<
210 unsafe extern "C-unwind" fn(
211 NonNull<c_void>,
212 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
213 Bool,
214 ) -> NonNull<c_void>,
215 >,
216 );
217
218 #[deprecated = "Garbage collection no longer supported"]
219 #[unsafe(method(usesStrongWriteBarrier))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn usesStrongWriteBarrier(&self) -> bool;
222
223 #[deprecated = "Garbage collection no longer supported"]
225 #[unsafe(method(setUsesStrongWriteBarrier:))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn setUsesStrongWriteBarrier(&self, uses_strong_write_barrier: bool);
228
229 #[deprecated = "Garbage collection no longer supported"]
230 #[unsafe(method(usesWeakReadAndWriteBarriers))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn usesWeakReadAndWriteBarriers(&self) -> bool;
233
234 #[deprecated = "Garbage collection no longer supported"]
236 #[unsafe(method(setUsesWeakReadAndWriteBarriers:))]
237 #[unsafe(method_family = none)]
238 pub unsafe fn setUsesWeakReadAndWriteBarriers(
239 &self,
240 uses_weak_read_and_write_barriers: bool,
241 );
242 );
243}
244
245impl NSPointerFunctions {
247 extern_methods!(
248 #[unsafe(method(init))]
249 #[unsafe(method_family = init)]
250 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
251
252 #[unsafe(method(new))]
253 #[unsafe(method_family = new)]
254 pub unsafe fn new() -> Retained<Self>;
255 );
256}