objc2_health_kit/generated/
HKStatisticsCollectionQuery.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 #[unsafe(super(NSObject))]
13 #[derive(Debug, PartialEq, Eq, Hash)]
14 pub struct HKStatisticsCollection;
15);
16
17unsafe impl Send for HKStatisticsCollection {}
18
19unsafe impl Sync for HKStatisticsCollection {}
20
21extern_conformance!(
22 unsafe impl NSObjectProtocol for HKStatisticsCollection {}
23);
24
25impl HKStatisticsCollection {
26 extern_methods!(
27 #[unsafe(method(init))]
28 #[unsafe(method_family = init)]
29 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
30
31 #[cfg(feature = "HKStatistics")]
32 #[unsafe(method(statisticsForDate:))]
36 #[unsafe(method_family = none)]
37 pub unsafe fn statisticsForDate(&self, date: &NSDate) -> Option<Retained<HKStatistics>>;
38
39 #[cfg(all(feature = "HKStatistics", feature = "block2"))]
40 #[unsafe(method(enumerateStatisticsFromDate:toDate:withBlock:))]
45 #[unsafe(method_family = none)]
46 pub unsafe fn enumerateStatisticsFromDate_toDate_withBlock(
47 &self,
48 start_date: &NSDate,
49 end_date: &NSDate,
50 block: &block2::DynBlock<dyn Fn(NonNull<HKStatistics>, NonNull<Bool>)>,
51 );
52
53 #[cfg(feature = "HKStatistics")]
54 #[unsafe(method(statistics))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn statistics(&self) -> Retained<NSArray<HKStatistics>>;
60
61 #[cfg(feature = "HKSource")]
62 #[unsafe(method(sources))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn sources(&self) -> Retained<NSSet<HKSource>>;
69 );
70}
71
72impl HKStatisticsCollection {
74 extern_methods!(
75 #[unsafe(method(new))]
76 #[unsafe(method_family = new)]
77 pub unsafe fn new() -> Retained<Self>;
78 );
79}
80
81extern_class!(
82 #[unsafe(super(HKQuery, NSObject))]
84 #[derive(Debug, PartialEq, Eq, Hash)]
85 #[cfg(feature = "HKQuery")]
86 pub struct HKStatisticsCollectionQuery;
87);
88
89#[cfg(feature = "HKQuery")]
90unsafe impl Send for HKStatisticsCollectionQuery {}
91
92#[cfg(feature = "HKQuery")]
93unsafe impl Sync for HKStatisticsCollectionQuery {}
94
95#[cfg(feature = "HKQuery")]
96extern_conformance!(
97 unsafe impl NSObjectProtocol for HKStatisticsCollectionQuery {}
98);
99
100#[cfg(feature = "HKQuery")]
101impl HKStatisticsCollectionQuery {
102 extern_methods!(
103 #[unsafe(method(anchorDate))]
104 #[unsafe(method_family = none)]
105 pub unsafe fn anchorDate(&self) -> Retained<NSDate>;
106
107 #[cfg(feature = "HKStatistics")]
108 #[unsafe(method(options))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn options(&self) -> HKStatisticsOptions;
111
112 #[unsafe(method(intervalComponents))]
113 #[unsafe(method_family = none)]
114 pub unsafe fn intervalComponents(&self) -> Retained<NSDateComponents>;
115
116 #[cfg(feature = "block2")]
117 #[unsafe(method(initialResultsHandler))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn initialResultsHandler(
126 &self,
127 ) -> *mut block2::DynBlock<
128 dyn Fn(NonNull<HKStatisticsCollectionQuery>, *mut HKStatisticsCollection, *mut NSError),
129 >;
130
131 #[cfg(feature = "block2")]
132 #[unsafe(method(setInitialResultsHandler:))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn setInitialResultsHandler(
143 &self,
144 initial_results_handler: Option<
145 &block2::DynBlock<
146 dyn Fn(
147 NonNull<HKStatisticsCollectionQuery>,
148 *mut HKStatisticsCollection,
149 *mut NSError,
150 ),
151 >,
152 >,
153 );
154
155 #[cfg(all(feature = "HKStatistics", feature = "block2"))]
156 #[unsafe(method(statisticsUpdateHandler))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn statisticsUpdateHandler(
165 &self,
166 ) -> *mut block2::DynBlock<
167 dyn Fn(
168 NonNull<HKStatisticsCollectionQuery>,
169 *mut HKStatistics,
170 *mut HKStatisticsCollection,
171 *mut NSError,
172 ),
173 >;
174
175 #[cfg(all(feature = "HKStatistics", feature = "block2"))]
176 #[unsafe(method(setStatisticsUpdateHandler:))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn setStatisticsUpdateHandler(
187 &self,
188 statistics_update_handler: Option<
189 &block2::DynBlock<
190 dyn Fn(
191 NonNull<HKStatisticsCollectionQuery>,
192 *mut HKStatistics,
193 *mut HKStatisticsCollection,
194 *mut NSError,
195 ),
196 >,
197 >,
198 );
199
200 #[cfg(all(feature = "HKObjectType", feature = "HKStatistics"))]
201 #[unsafe(method(initWithQuantityType:quantitySamplePredicate:options:anchorDate:intervalComponents:))]
202 #[unsafe(method_family = init)]
203 pub unsafe fn initWithQuantityType_quantitySamplePredicate_options_anchorDate_intervalComponents(
204 this: Allocated<Self>,
205 quantity_type: &HKQuantityType,
206 quantity_sample_predicate: Option<&NSPredicate>,
207 options: HKStatisticsOptions,
208 anchor_date: &NSDate,
209 interval_components: &NSDateComponents,
210 ) -> Retained<Self>;
211 );
212}
213
214#[cfg(feature = "HKQuery")]
216impl HKStatisticsCollectionQuery {
217 extern_methods!(
218 #[unsafe(method(init))]
219 #[unsafe(method_family = init)]
220 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
221 );
222}
223
224#[cfg(feature = "HKQuery")]
226impl HKStatisticsCollectionQuery {
227 extern_methods!(
228 #[unsafe(method(new))]
229 #[unsafe(method_family = new)]
230 pub unsafe fn new() -> Retained<Self>;
231 );
232}