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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;

use crate::*;

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPointerFunctionsOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSPointerFunctionsOptions: NSUInteger {
        const NSPointerFunctionsStrongMemory = 0<<0;
#[deprecated = "GC no longer supported"]
        const NSPointerFunctionsZeroingWeakMemory = 1<<0;
        const NSPointerFunctionsOpaqueMemory = 2<<0;
        const NSPointerFunctionsMallocMemory = 3<<0;
        const NSPointerFunctionsMachVirtualMemory = 4<<0;
        const NSPointerFunctionsWeakMemory = 5<<0;
        const NSPointerFunctionsObjectPersonality = 0<<8;
        const NSPointerFunctionsOpaquePersonality = 1<<8;
        const NSPointerFunctionsObjectPointerPersonality = 2<<8;
        const NSPointerFunctionsCStringPersonality = 3<<8;
        const NSPointerFunctionsStructPersonality = 4<<8;
        const NSPointerFunctionsIntegerPersonality = 5<<8;
        const NSPointerFunctionsCopyIn = 1<<16;
    }
}

unsafe impl Encode for NSPointerFunctionsOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSPointerFunctionsOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSPointerFunctions;

    unsafe impl ClassType for NSPointerFunctions {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSPointerFunctions {}

unsafe impl NSObjectProtocol for NSPointerFunctions {}

extern_methods!(
    unsafe impl NSPointerFunctions {
        #[method_id(@__retain_semantics Init initWithOptions:)]
        pub unsafe fn initWithOptions(
            this: Allocated<Self>,
            options: NSPointerFunctionsOptions,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Other pointerFunctionsWithOptions:)]
        pub unsafe fn pointerFunctionsWithOptions(
            options: NSPointerFunctionsOptions,
        ) -> Retained<NSPointerFunctions>;

        #[method(hashFunction)]
        pub unsafe fn hashFunction(
            &self,
        ) -> Option<
            unsafe extern "C" fn(
                NonNull<c_void>,
                Option<unsafe extern "C" fn(NonNull<c_void>) -> NSUInteger>,
            ) -> NSUInteger,
        >;

        #[method(setHashFunction:)]
        pub unsafe fn setHashFunction(
            &self,
            hash_function: Option<
                unsafe extern "C" fn(
                    NonNull<c_void>,
                    Option<unsafe extern "C" fn(NonNull<c_void>) -> NSUInteger>,
                ) -> NSUInteger,
            >,
        );

        #[method(isEqualFunction)]
        pub unsafe fn isEqualFunction(
            &self,
        ) -> Option<
            unsafe extern "C" fn(
                NonNull<c_void>,
                NonNull<c_void>,
                Option<unsafe extern "C" fn(NonNull<c_void>) -> NSUInteger>,
            ) -> Bool,
        >;

        #[method(setIsEqualFunction:)]
        pub unsafe fn setIsEqualFunction(
            &self,
            is_equal_function: Option<
                unsafe extern "C" fn(
                    NonNull<c_void>,
                    NonNull<c_void>,
                    Option<unsafe extern "C" fn(NonNull<c_void>) -> NSUInteger>,
                ) -> Bool,
            >,
        );

        #[method(sizeFunction)]
        pub unsafe fn sizeFunction(
            &self,
        ) -> Option<unsafe extern "C" fn(NonNull<c_void>) -> NSUInteger>;

        #[method(setSizeFunction:)]
        pub unsafe fn setSizeFunction(
            &self,
            size_function: Option<unsafe extern "C" fn(NonNull<c_void>) -> NSUInteger>,
        );

        #[cfg(feature = "NSString")]
        #[method(descriptionFunction)]
        pub unsafe fn descriptionFunction(
            &self,
        ) -> Option<unsafe extern "C" fn(NonNull<c_void>) -> *mut NSString>;

        #[cfg(feature = "NSString")]
        #[method(setDescriptionFunction:)]
        pub unsafe fn setDescriptionFunction(
            &self,
            description_function: Option<unsafe extern "C" fn(NonNull<c_void>) -> *mut NSString>,
        );

        #[method(relinquishFunction)]
        pub unsafe fn relinquishFunction(
            &self,
        ) -> Option<
            unsafe extern "C" fn(
                NonNull<c_void>,
                Option<unsafe extern "C" fn(NonNull<c_void>) -> NSUInteger>,
            ),
        >;

        #[method(setRelinquishFunction:)]
        pub unsafe fn setRelinquishFunction(
            &self,
            relinquish_function: Option<
                unsafe extern "C" fn(
                    NonNull<c_void>,
                    Option<unsafe extern "C" fn(NonNull<c_void>) -> NSUInteger>,
                ),
            >,
        );

        #[method(acquireFunction)]
        pub unsafe fn acquireFunction(
            &self,
        ) -> Option<
            unsafe extern "C" fn(
                NonNull<c_void>,
                Option<unsafe extern "C" fn(NonNull<c_void>) -> NSUInteger>,
                Bool,
            ) -> NonNull<c_void>,
        >;

        #[method(setAcquireFunction:)]
        pub unsafe fn setAcquireFunction(
            &self,
            acquire_function: Option<
                unsafe extern "C" fn(
                    NonNull<c_void>,
                    Option<unsafe extern "C" fn(NonNull<c_void>) -> NSUInteger>,
                    Bool,
                ) -> NonNull<c_void>,
            >,
        );

        #[deprecated = "Garbage collection no longer supported"]
        #[method(usesStrongWriteBarrier)]
        pub unsafe fn usesStrongWriteBarrier(&self) -> bool;

        #[deprecated = "Garbage collection no longer supported"]
        #[method(setUsesStrongWriteBarrier:)]
        pub unsafe fn setUsesStrongWriteBarrier(&self, uses_strong_write_barrier: bool);

        #[deprecated = "Garbage collection no longer supported"]
        #[method(usesWeakReadAndWriteBarriers)]
        pub unsafe fn usesWeakReadAndWriteBarriers(&self) -> bool;

        #[deprecated = "Garbage collection no longer supported"]
        #[method(setUsesWeakReadAndWriteBarriers:)]
        pub unsafe fn setUsesWeakReadAndWriteBarriers(
            &self,
            uses_weak_read_and_write_barriers: bool,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSPointerFunctions {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);