icrate 0.1.2

Bindings to Apple's frameworks
Documentation
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::CoreLocation::*;
use crate::Foundation::*;
use crate::HealthKit::*;
use crate::UniformTypeIdentifiers::*;

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "HealthKit_HKUnit")]
    pub struct HKUnit;

    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl ClassType for HKUnit {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "HealthKit_HKUnit")]
unsafe impl NSCoding for HKUnit {}

#[cfg(feature = "HealthKit_HKUnit")]
unsafe impl NSCopying for HKUnit {}

#[cfg(feature = "HealthKit_HKUnit")]
unsafe impl NSObjectProtocol for HKUnit {}

#[cfg(feature = "HealthKit_HKUnit")]
unsafe impl NSSecureCoding for HKUnit {}

extern_methods!(
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other unitString)]
        pub unsafe fn unitString(&self) -> Id<NSString>;

        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other unitFromString:)]
        pub unsafe fn unitFromString(string: &NSString) -> Id<Self>;

        #[method_id(@__retain_semantics Other unitFromMassFormatterUnit:)]
        pub unsafe fn unitFromMassFormatterUnit(
            mass_formatter_unit: NSMassFormatterUnit,
        ) -> Id<Self>;

        #[method(massFormatterUnitFromUnit:)]
        pub unsafe fn massFormatterUnitFromUnit(unit: &HKUnit) -> NSMassFormatterUnit;

        #[method_id(@__retain_semantics Other unitFromLengthFormatterUnit:)]
        pub unsafe fn unitFromLengthFormatterUnit(
            length_formatter_unit: NSLengthFormatterUnit,
        ) -> Id<Self>;

        #[method(lengthFormatterUnitFromUnit:)]
        pub unsafe fn lengthFormatterUnitFromUnit(unit: &HKUnit) -> NSLengthFormatterUnit;

        #[method_id(@__retain_semantics Other unitFromEnergyFormatterUnit:)]
        pub unsafe fn unitFromEnergyFormatterUnit(
            energy_formatter_unit: NSEnergyFormatterUnit,
        ) -> Id<Self>;

        #[method(energyFormatterUnitFromUnit:)]
        pub unsafe fn energyFormatterUnitFromUnit(unit: &HKUnit) -> NSEnergyFormatterUnit;

        #[method(isNull)]
        pub unsafe fn isNull(&self) -> bool;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);

ns_enum!(
    #[underlying(NSInteger)]
    pub enum HKMetricPrefix {
        HKMetricPrefixNone = 0,
        HKMetricPrefixFemto = 13,
        HKMetricPrefixPico = 1,
        HKMetricPrefixNano = 2,
        HKMetricPrefixMicro = 3,
        HKMetricPrefixMilli = 4,
        HKMetricPrefixCenti = 5,
        HKMetricPrefixDeci = 6,
        HKMetricPrefixDeca = 7,
        HKMetricPrefixHecto = 8,
        HKMetricPrefixKilo = 9,
        HKMetricPrefixMega = 10,
        HKMetricPrefixGiga = 11,
        HKMetricPrefixTera = 12,
    }
);

extern_methods!(
    /// Mass
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other gramUnitWithMetricPrefix:)]
        pub unsafe fn gramUnitWithMetricPrefix(prefix: HKMetricPrefix) -> Id<Self>;

        #[method_id(@__retain_semantics Other gramUnit)]
        pub unsafe fn gramUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other ounceUnit)]
        pub unsafe fn ounceUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other poundUnit)]
        pub unsafe fn poundUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other stoneUnit)]
        pub unsafe fn stoneUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other moleUnitWithMetricPrefix:molarMass:)]
        pub unsafe fn moleUnitWithMetricPrefix_molarMass(
            prefix: HKMetricPrefix,
            grams_per_mole: c_double,
        ) -> Id<Self>;

        #[method_id(@__retain_semantics Other moleUnitWithMolarMass:)]
        pub unsafe fn moleUnitWithMolarMass(grams_per_mole: c_double) -> Id<Self>;
    }
);

extern_methods!(
    /// Length
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other meterUnitWithMetricPrefix:)]
        pub unsafe fn meterUnitWithMetricPrefix(prefix: HKMetricPrefix) -> Id<Self>;

        #[method_id(@__retain_semantics Other meterUnit)]
        pub unsafe fn meterUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other inchUnit)]
        pub unsafe fn inchUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other footUnit)]
        pub unsafe fn footUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other yardUnit)]
        pub unsafe fn yardUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other mileUnit)]
        pub unsafe fn mileUnit() -> Id<Self>;
    }
);

extern_methods!(
    /// Volume
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other literUnitWithMetricPrefix:)]
        pub unsafe fn literUnitWithMetricPrefix(prefix: HKMetricPrefix) -> Id<Self>;

        #[method_id(@__retain_semantics Other literUnit)]
        pub unsafe fn literUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other fluidOunceUSUnit)]
        pub unsafe fn fluidOunceUSUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other fluidOunceImperialUnit)]
        pub unsafe fn fluidOunceImperialUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other pintUSUnit)]
        pub unsafe fn pintUSUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other pintImperialUnit)]
        pub unsafe fn pintImperialUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other cupUSUnit)]
        pub unsafe fn cupUSUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other cupImperialUnit)]
        pub unsafe fn cupImperialUnit() -> Id<Self>;
    }
);

extern_methods!(
    /// Pressure
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other pascalUnitWithMetricPrefix:)]
        pub unsafe fn pascalUnitWithMetricPrefix(prefix: HKMetricPrefix) -> Id<Self>;

        #[method_id(@__retain_semantics Other pascalUnit)]
        pub unsafe fn pascalUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other millimeterOfMercuryUnit)]
        pub unsafe fn millimeterOfMercuryUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other centimeterOfWaterUnit)]
        pub unsafe fn centimeterOfWaterUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other atmosphereUnit)]
        pub unsafe fn atmosphereUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other decibelAWeightedSoundPressureLevelUnit)]
        pub unsafe fn decibelAWeightedSoundPressureLevelUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other inchesOfMercuryUnit)]
        pub unsafe fn inchesOfMercuryUnit() -> Id<Self>;
    }
);

extern_methods!(
    /// Time
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other secondUnitWithMetricPrefix:)]
        pub unsafe fn secondUnitWithMetricPrefix(prefix: HKMetricPrefix) -> Id<Self>;

        #[method_id(@__retain_semantics Other secondUnit)]
        pub unsafe fn secondUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other minuteUnit)]
        pub unsafe fn minuteUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other hourUnit)]
        pub unsafe fn hourUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other dayUnit)]
        pub unsafe fn dayUnit() -> Id<Self>;
    }
);

extern_methods!(
    /// Energy
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other jouleUnitWithMetricPrefix:)]
        pub unsafe fn jouleUnitWithMetricPrefix(prefix: HKMetricPrefix) -> Id<Self>;

        #[method_id(@__retain_semantics Other jouleUnit)]
        pub unsafe fn jouleUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other kilocalorieUnit)]
        pub unsafe fn kilocalorieUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other smallCalorieUnit)]
        pub unsafe fn smallCalorieUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other largeCalorieUnit)]
        pub unsafe fn largeCalorieUnit() -> Id<Self>;

        #[deprecated = "Use smallCalorieUnit or largeCalorieUnit, depending on which you mean"]
        #[method_id(@__retain_semantics Other calorieUnit)]
        pub unsafe fn calorieUnit() -> Id<Self>;
    }
);

extern_methods!(
    /// Temperature
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other degreeCelsiusUnit)]
        pub unsafe fn degreeCelsiusUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other degreeFahrenheitUnit)]
        pub unsafe fn degreeFahrenheitUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other kelvinUnit)]
        pub unsafe fn kelvinUnit() -> Id<Self>;
    }
);

extern_methods!(
    /// Conductance
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other siemenUnitWithMetricPrefix:)]
        pub unsafe fn siemenUnitWithMetricPrefix(prefix: HKMetricPrefix) -> Id<Self>;

        #[method_id(@__retain_semantics Other siemenUnit)]
        pub unsafe fn siemenUnit() -> Id<Self>;
    }
);

extern_methods!(
    /// Pharmacology
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other internationalUnit)]
        pub unsafe fn internationalUnit() -> Id<Self>;
    }
);

extern_methods!(
    /// Scalar
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other countUnit)]
        pub unsafe fn countUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other percentUnit)]
        pub unsafe fn percentUnit() -> Id<Self>;
    }
);

extern_methods!(
    /// HearingSensitivity
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other decibelHearingLevelUnit)]
        pub unsafe fn decibelHearingLevelUnit() -> Id<Self>;
    }
);

extern_methods!(
    /// Math
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other unitMultipliedByUnit:)]
        pub unsafe fn unitMultipliedByUnit(&self, unit: &HKUnit) -> Id<HKUnit>;

        #[method_id(@__retain_semantics Other unitDividedByUnit:)]
        pub unsafe fn unitDividedByUnit(&self, unit: &HKUnit) -> Id<HKUnit>;

        #[method_id(@__retain_semantics Other unitRaisedToPower:)]
        pub unsafe fn unitRaisedToPower(&self, power: NSInteger) -> Id<HKUnit>;

        #[method_id(@__retain_semantics Other reciprocalUnit)]
        pub unsafe fn reciprocalUnit(&self) -> Id<HKUnit>;
    }
);

extern_methods!(
    /// Frequency
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other hertzUnitWithMetricPrefix:)]
        pub unsafe fn hertzUnitWithMetricPrefix(prefix: HKMetricPrefix) -> Id<Self>;

        #[method_id(@__retain_semantics Other hertzUnit)]
        pub unsafe fn hertzUnit() -> Id<Self>;
    }
);

extern_methods!(
    /// ElectricPotentialDifference
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other voltUnitWithMetricPrefix:)]
        pub unsafe fn voltUnitWithMetricPrefix(prefix: HKMetricPrefix) -> Id<Self>;

        #[method_id(@__retain_semantics Other voltUnit)]
        pub unsafe fn voltUnit() -> Id<Self>;
    }
);

extern_methods!(
    /// Power
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other wattUnitWithMetricPrefix:)]
        pub unsafe fn wattUnitWithMetricPrefix(prefix: HKMetricPrefix) -> Id<Self>;

        #[method_id(@__retain_semantics Other wattUnit)]
        pub unsafe fn wattUnit() -> Id<Self>;
    }
);

extern_methods!(
    /// OpticalPower
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other diopterUnit)]
        pub unsafe fn diopterUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other prismDiopterUnit)]
        pub unsafe fn prismDiopterUnit() -> Id<Self>;
    }
);

extern_methods!(
    /// Angle
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other radianAngleUnitWithMetricPrefix:)]
        pub unsafe fn radianAngleUnitWithMetricPrefix(prefix: HKMetricPrefix) -> Id<Self>;

        #[method_id(@__retain_semantics Other radianAngleUnit)]
        pub unsafe fn radianAngleUnit() -> Id<Self>;

        #[method_id(@__retain_semantics Other degreeAngleUnit)]
        pub unsafe fn degreeAngleUnit() -> Id<Self>;
    }
);

extern_methods!(
    /// Illuminance
    #[cfg(feature = "HealthKit_HKUnit")]
    unsafe impl HKUnit {
        #[method_id(@__retain_semantics Other luxUnitWithMetricPrefix:)]
        pub unsafe fn luxUnitWithMetricPrefix(prefix: HKMetricPrefix) -> Id<Self>;

        #[method_id(@__retain_semantics Other luxUnit)]
        pub unsafe fn luxUnit() -> Id<Self>;
    }
);