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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
/// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkobjectquerynolimit?language=objc)
pub static HKObjectQueryNoLimit: NSUInteger = 0;
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hksamplequery?language=objc)
#[unsafe(super(HKQuery, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "HKQuery")]
pub struct HKSampleQuery;
);
#[cfg(feature = "HKQuery")]
unsafe impl Send for HKSampleQuery {}
#[cfg(feature = "HKQuery")]
unsafe impl Sync for HKSampleQuery {}
#[cfg(feature = "HKQuery")]
extern_conformance!(
unsafe impl NSObjectProtocol for HKSampleQuery {}
);
#[cfg(feature = "HKQuery")]
impl HKSampleQuery {
extern_methods!(
/// The maximum number of results the receiver will return upon completion.
#[unsafe(method(limit))]
#[unsafe(method_family = none)]
pub unsafe fn limit(&self) -> NSUInteger;
/// An array of NSSortDescriptors.
#[unsafe(method(sortDescriptors))]
#[unsafe(method_family = none)]
pub unsafe fn sortDescriptors(&self) -> Option<Retained<NSArray<NSSortDescriptor>>>;
#[cfg(all(
feature = "HKObject",
feature = "HKObjectType",
feature = "HKSample",
feature = "block2"
))]
/// Returns a query that will retrieve HKSamples matching the given predicate.
///
///
/// Parameter `sampleType`: The type of sample to retrieve.
///
/// Parameter `predicate`: The predicate which samples should match.
///
/// Parameter `limit`: The maximum number of samples to return. Pass HKObjectQueryNoLimit for no limit.
///
/// Parameter `sortDescriptors`: The sort descriptors to use to order the resulting samples.
///
/// Parameter `resultsHandler`: The block to invoke with results when the query has finished executing.
///
/// # Safety
///
/// `results_handler` block must be sendable.
#[unsafe(method(initWithSampleType:predicate:limit:sortDescriptors:resultsHandler:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithSampleType_predicate_limit_sortDescriptors_resultsHandler(
this: Allocated<Self>,
sample_type: &HKSampleType,
predicate: Option<&NSPredicate>,
limit: NSUInteger,
sort_descriptors: Option<&NSArray<NSSortDescriptor>>,
results_handler: &block2::DynBlock<
dyn Fn(NonNull<HKSampleQuery>, *mut NSArray<HKSample>, *mut NSError),
>,
) -> Retained<Self>;
#[cfg(all(
feature = "HKObject",
feature = "HKQueryDescriptor",
feature = "HKSample",
feature = "block2"
))]
/// Returns a query that will retrieve HKSamples matching any of the given queryDescriptors.
///
///
/// Parameter `queryDescriptors`: An array of query descriptors that describes the sample types and predicates
/// used for querying.
///
/// Parameter `limit`: The maximum number of samples to return. Pass HKObjectQueryNoLimit
/// for no limit.
///
/// Parameter `resultsHandler`: The block to invoke with results when the query has finished executing. This
/// block is invoked once with results, an array of HKSamples matching the
/// queryDescriptors passed in, or nil if an error occurred.
///
/// # Safety
///
/// `results_handler` block must be sendable.
#[unsafe(method(initWithQueryDescriptors:limit:resultsHandler:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithQueryDescriptors_limit_resultsHandler(
this: Allocated<Self>,
query_descriptors: &NSArray<HKQueryDescriptor>,
limit: NSInteger,
results_handler: &block2::DynBlock<
dyn Fn(NonNull<HKSampleQuery>, *mut NSArray<HKSample>, *mut NSError),
>,
) -> Retained<Self>;
#[cfg(all(
feature = "HKObject",
feature = "HKQueryDescriptor",
feature = "HKSample",
feature = "block2"
))]
/// Returns a query that will retrieve HKSamples matching any of the given queryDescriptors.
///
///
/// Parameter `queryDescriptors`: An array of query descriptors that describes the sample types and predicates
/// used for querying.
///
/// Parameter `limit`: The maximum number of samples to return. Pass HKObjectQueryNoLimit
/// for no limit.
///
/// Parameter `sortDescriptors`: The sort descriptors to use to order the resulting samples.
///
/// Parameter `resultsHandler`: The block to invoke with results when the query has finished executing. This
/// block is invoked once with results, an array of HKSamples matching the
/// queryDescriptors passed in, or nil if an error occurred. The HKSamples in the
/// array are sorted by the specified sortDescriptors.
///
/// # Safety
///
/// `results_handler` block must be sendable.
#[unsafe(method(initWithQueryDescriptors:limit:sortDescriptors:resultsHandler:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithQueryDescriptors_limit_sortDescriptors_resultsHandler(
this: Allocated<Self>,
query_descriptors: &NSArray<HKQueryDescriptor>,
limit: NSInteger,
sort_descriptors: &NSArray<NSSortDescriptor>,
results_handler: &block2::DynBlock<
dyn Fn(NonNull<HKSampleQuery>, *mut NSArray<HKSample>, *mut NSError),
>,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `HKQuery`.
#[cfg(feature = "HKQuery")]
impl HKSampleQuery {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(feature = "HKQuery")]
impl HKSampleQuery {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}