objc2_health_kit/generated/
HKQuantitySeriesSampleQuery.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkquantityseriessamplequery?language=objc)
12    #[unsafe(super(HKQuery, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(feature = "HKQuery")]
15    pub struct HKQuantitySeriesSampleQuery;
16);
17
18#[cfg(feature = "HKQuery")]
19unsafe impl Send for HKQuantitySeriesSampleQuery {}
20
21#[cfg(feature = "HKQuery")]
22unsafe impl Sync for HKQuantitySeriesSampleQuery {}
23
24#[cfg(feature = "HKQuery")]
25extern_conformance!(
26    unsafe impl NSObjectProtocol for HKQuantitySeriesSampleQuery {}
27);
28
29#[cfg(feature = "HKQuery")]
30impl HKQuantitySeriesSampleQuery {
31    extern_methods!(
32        /// Include owning HKQuantitySample in quantityHandler handler.
33        ///
34        /// Default value is NO.
35        /// If includeSample is set then the quantitySample parameter of quantityHandler will
36        /// be non-nil anytime the quantity parameter is non-nil.
37        /// Specifying this option has a performance cost.
38        /// This property may not be modified once the query has been executed.
39        ///
40        /// This property is not atomic.
41        ///
42        /// # Safety
43        ///
44        /// This might not be thread-safe.
45        #[unsafe(method(includeSample))]
46        #[unsafe(method_family = none)]
47        pub unsafe fn includeSample(&self) -> bool;
48
49        /// Setter for [`includeSample`][Self::includeSample].
50        ///
51        /// # Safety
52        ///
53        /// This might not be thread-safe.
54        #[unsafe(method(setIncludeSample:))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn setIncludeSample(&self, include_sample: bool);
57
58        /// Order enumerated results first by quantitySample.startDate,
59        /// then by the quantity's dateInterval.startDate.
60        ///
61        /// Default value is NO.
62        /// All quantities owned by a given quantitySample will be
63        /// enumerated before any quantities owned by any other quantity sample,
64        /// and the quantity samples will be enumerated in their startDate order.
65        /// Note that individual quantities may not be returned in their
66        /// dateInterval.startDate order if more than one quantitySample overlap in time.
67        /// This property may not be modified once the query has been executed.
68        ///
69        /// This property is not atomic.
70        ///
71        /// # Safety
72        ///
73        /// This might not be thread-safe.
74        #[unsafe(method(orderByQuantitySampleStartDate))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn orderByQuantitySampleStartDate(&self) -> bool;
77
78        /// Setter for [`orderByQuantitySampleStartDate`][Self::orderByQuantitySampleStartDate].
79        ///
80        /// # Safety
81        ///
82        /// This might not be thread-safe.
83        #[unsafe(method(setOrderByQuantitySampleStartDate:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn setOrderByQuantitySampleStartDate(
86            &self,
87            order_by_quantity_sample_start_date: bool,
88        );
89
90        #[cfg(all(
91            feature = "HKObject",
92            feature = "HKObjectType",
93            feature = "HKQuantity",
94            feature = "HKQuantitySample",
95            feature = "HKSample",
96            feature = "block2"
97        ))]
98        /// Returns a query that will retrieve HKQuantity objects for samples of a specified
99        /// type that match the specified predicate.
100        ///
101        ///
102        /// Parameter `quantityType`: The type of HKQuantitySample to retrieve.
103        ///
104        /// Parameter `predicate`: The predicate which the query results should match.
105        /// To query for the quantities for a specific quantity sample
106        /// see: +[HKPredicates predicateForObjectWithUUID:]
107        ///
108        ///
109        /// Parameter `quantityHandler`: The block to invoke with results from the query. It will be
110        /// called repeatedly with HKQuantity, and NSDateInterval objects in
111        /// ascending dateInterval.startDate order, until all quantities are
112        /// returned and the done parameter is YES
113        /// or -[HKHealthStore stopQuery:] is called.
114        /// The quantitySample parameter is nil unless includeSample is YES,
115        /// in which case it will be the quantitySample which owns the current
116        /// quantity anytime the quantity paramater is non-nil.
117        /// The stopQuery call can be made within the quantityHandler block.
118        /// Once done is YES, or stopQuery has been called, the query is
119        /// complete and no more calls to quantityHandler will be made.
120        ///
121        /// # Safety
122        ///
123        /// `quantity_handler` block must be sendable.
124        #[unsafe(method(initWithQuantityType:predicate:quantityHandler:))]
125        #[unsafe(method_family = init)]
126        pub unsafe fn initWithQuantityType_predicate_quantityHandler(
127            this: Allocated<Self>,
128            quantity_type: &HKQuantityType,
129            predicate: Option<&NSPredicate>,
130            quantity_handler: &block2::DynBlock<
131                dyn Fn(
132                    NonNull<HKQuantitySeriesSampleQuery>,
133                    *mut HKQuantity,
134                    *mut NSDateInterval,
135                    *mut HKQuantitySample,
136                    Bool,
137                    *mut NSError,
138                ),
139            >,
140        ) -> Retained<Self>;
141
142        #[cfg(all(
143            feature = "HKObject",
144            feature = "HKQuantity",
145            feature = "HKQuantitySample",
146            feature = "HKSample",
147            feature = "block2"
148        ))]
149        /// # Safety
150        ///
151        /// `quantity_handler` block must be sendable.
152        #[deprecated]
153        #[unsafe(method(initWithSample:quantityHandler:))]
154        #[unsafe(method_family = init)]
155        pub unsafe fn initWithSample_quantityHandler(
156            this: Allocated<Self>,
157            quantity_sample: &HKQuantitySample,
158            quantity_handler: &block2::DynBlock<
159                dyn Fn(
160                    NonNull<HKQuantitySeriesSampleQuery>,
161                    *mut HKQuantity,
162                    *mut NSDate,
163                    Bool,
164                    *mut NSError,
165                ),
166            >,
167        ) -> Retained<Self>;
168    );
169}
170
171/// Methods declared on superclass `HKQuery`.
172#[cfg(feature = "HKQuery")]
173impl HKQuantitySeriesSampleQuery {
174    extern_methods!(
175        #[unsafe(method(init))]
176        #[unsafe(method_family = init)]
177        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
178    );
179}
180
181/// Methods declared on superclass `NSObject`.
182#[cfg(feature = "HKQuery")]
183impl HKQuantitySeriesSampleQuery {
184    extern_methods!(
185        #[unsafe(method(new))]
186        #[unsafe(method_family = new)]
187        pub unsafe fn new() -> Retained<Self>;
188    );
189}