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 #[doc(alias = "NSPointerFunctionsZeroingWeakMemory")]
19#[deprecated = "GC no longer supported"]
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")]
62extern_conformance!(
63 unsafe impl NSCopying for NSPointerFunctions {}
64);
65
66#[cfg(feature = "NSObject")]
67unsafe impl CopyingHelper for NSPointerFunctions {
68 type Result = Self;
69}
70
71extern_conformance!(
72 unsafe impl NSObjectProtocol for NSPointerFunctions {}
73);
74
75impl NSPointerFunctions {
76 extern_methods!(
77 #[unsafe(method(initWithOptions:))]
78 #[unsafe(method_family = init)]
79 pub unsafe fn initWithOptions(
80 this: Allocated<Self>,
81 options: NSPointerFunctionsOptions,
82 ) -> Retained<Self>;
83
84 #[unsafe(method(pointerFunctionsWithOptions:))]
85 #[unsafe(method_family = none)]
86 pub unsafe fn pointerFunctionsWithOptions(
87 options: NSPointerFunctionsOptions,
88 ) -> Retained<NSPointerFunctions>;
89
90 #[unsafe(method(hashFunction))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn hashFunction(
93 &self,
94 ) -> Option<
95 unsafe extern "C-unwind" fn(
96 NonNull<c_void>,
97 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
98 ) -> NSUInteger,
99 >;
100
101 #[unsafe(method(setHashFunction:))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn setHashFunction(
105 &self,
106 hash_function: Option<
107 unsafe extern "C-unwind" fn(
108 NonNull<c_void>,
109 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
110 ) -> NSUInteger,
111 >,
112 );
113
114 #[unsafe(method(isEqualFunction))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn isEqualFunction(
117 &self,
118 ) -> Option<
119 unsafe extern "C-unwind" fn(
120 NonNull<c_void>,
121 NonNull<c_void>,
122 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
123 ) -> Bool,
124 >;
125
126 #[unsafe(method(setIsEqualFunction:))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn setIsEqualFunction(
130 &self,
131 is_equal_function: Option<
132 unsafe extern "C-unwind" fn(
133 NonNull<c_void>,
134 NonNull<c_void>,
135 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
136 ) -> Bool,
137 >,
138 );
139
140 #[unsafe(method(sizeFunction))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn sizeFunction(
143 &self,
144 ) -> Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>;
145
146 #[unsafe(method(setSizeFunction:))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn setSizeFunction(
150 &self,
151 size_function: Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
152 );
153
154 #[cfg(feature = "NSString")]
155 #[unsafe(method(descriptionFunction))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn descriptionFunction(
158 &self,
159 ) -> Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> *mut NSString>;
160
161 #[cfg(feature = "NSString")]
162 #[unsafe(method(setDescriptionFunction:))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn setDescriptionFunction(
166 &self,
167 description_function: Option<
168 unsafe extern "C-unwind" fn(NonNull<c_void>) -> *mut NSString,
169 >,
170 );
171
172 #[unsafe(method(relinquishFunction))]
173 #[unsafe(method_family = none)]
174 pub unsafe fn relinquishFunction(
175 &self,
176 ) -> Option<
177 unsafe extern "C-unwind" fn(
178 NonNull<c_void>,
179 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
180 ),
181 >;
182
183 #[unsafe(method(setRelinquishFunction:))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn setRelinquishFunction(
187 &self,
188 relinquish_function: Option<
189 unsafe extern "C-unwind" fn(
190 NonNull<c_void>,
191 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
192 ),
193 >,
194 );
195
196 #[unsafe(method(acquireFunction))]
197 #[unsafe(method_family = none)]
198 pub unsafe fn acquireFunction(
199 &self,
200 ) -> Option<
201 unsafe extern "C-unwind" fn(
202 NonNull<c_void>,
203 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
204 Bool,
205 ) -> NonNull<c_void>,
206 >;
207
208 #[unsafe(method(setAcquireFunction:))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn setAcquireFunction(
212 &self,
213 acquire_function: Option<
214 unsafe extern "C-unwind" fn(
215 NonNull<c_void>,
216 Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NSUInteger>,
217 Bool,
218 ) -> NonNull<c_void>,
219 >,
220 );
221
222 #[deprecated = "Garbage collection no longer supported"]
223 #[unsafe(method(usesStrongWriteBarrier))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn usesStrongWriteBarrier(&self) -> bool;
226
227 #[deprecated = "Garbage collection no longer supported"]
229 #[unsafe(method(setUsesStrongWriteBarrier:))]
230 #[unsafe(method_family = none)]
231 pub unsafe fn setUsesStrongWriteBarrier(&self, uses_strong_write_barrier: bool);
232
233 #[deprecated = "Garbage collection no longer supported"]
234 #[unsafe(method(usesWeakReadAndWriteBarriers))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn usesWeakReadAndWriteBarriers(&self) -> bool;
237
238 #[deprecated = "Garbage collection no longer supported"]
240 #[unsafe(method(setUsesWeakReadAndWriteBarriers:))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn setUsesWeakReadAndWriteBarriers(
243 &self,
244 uses_weak_read_and_write_barriers: bool,
245 );
246 );
247}
248
249impl NSPointerFunctions {
251 extern_methods!(
252 #[unsafe(method(init))]
253 #[unsafe(method_family = init)]
254 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
255
256 #[unsafe(method(new))]
257 #[unsafe(method_family = new)]
258 pub unsafe fn new() -> Retained<Self>;
259 );
260}