objc2_health_kit/generated/
HKObserverQuery.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
10/// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkobserverquerycompletionhandler?language=objc)
11#[cfg(feature = "block2")]
12pub type HKObserverQueryCompletionHandler = *mut block2::DynBlock<dyn Fn()>;
13
14extern_class!(
15    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkobserverquery?language=objc)
16    #[unsafe(super(HKQuery, NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    #[cfg(feature = "HKQuery")]
19    pub struct HKObserverQuery;
20);
21
22#[cfg(feature = "HKQuery")]
23unsafe impl Send for HKObserverQuery {}
24
25#[cfg(feature = "HKQuery")]
26unsafe impl Sync for HKObserverQuery {}
27
28#[cfg(feature = "HKQuery")]
29extern_conformance!(
30    unsafe impl NSObjectProtocol for HKObserverQuery {}
31);
32
33#[cfg(feature = "HKQuery")]
34impl HKObserverQuery {
35    extern_methods!(
36        #[cfg(all(feature = "HKObjectType", feature = "block2"))]
37        /// This method installs a handler that is called when a sample type has a new sample added.
38        ///
39        /// If you have subscribed to background updates you must call the passed completion block
40        /// once you have processed data from this notification. Otherwise the system will continue
41        /// to notify you of this data.
42        ///
43        /// # Safety
44        ///
45        /// `update_handler` block must be sendable.
46        #[unsafe(method(initWithSampleType:predicate:updateHandler:))]
47        #[unsafe(method_family = init)]
48        pub unsafe fn initWithSampleType_predicate_updateHandler(
49            this: Allocated<Self>,
50            sample_type: &HKSampleType,
51            predicate: Option<&NSPredicate>,
52            update_handler: &block2::DynBlock<
53                dyn Fn(NonNull<HKObserverQuery>, HKObserverQueryCompletionHandler, *mut NSError),
54            >,
55        ) -> Retained<Self>;
56
57        #[cfg(all(
58            feature = "HKObjectType",
59            feature = "HKQueryDescriptor",
60            feature = "block2"
61        ))]
62        /// This method installs a handler that is called when a sample matching the query descriptors is added.
63        ///
64        /// If you have subscribed to background updates you must call the passed completion block
65        /// once you have processed data from this notification. Otherwise the system will continue
66        /// to notify you of this data.
67        ///
68        ///
69        /// Parameter `queryDescriptors`: An array of query descriptors that describes the sample types and predicates for
70        /// which you are interested in getting notified.
71        ///
72        /// # Safety
73        ///
74        /// `update_handler` block must be sendable.
75        #[unsafe(method(initWithQueryDescriptors:updateHandler:))]
76        #[unsafe(method_family = init)]
77        pub unsafe fn initWithQueryDescriptors_updateHandler(
78            this: Allocated<Self>,
79            query_descriptors: &NSArray<HKQueryDescriptor>,
80            update_handler: &block2::DynBlock<
81                dyn Fn(
82                    NonNull<HKObserverQuery>,
83                    *mut NSSet<HKSampleType>,
84                    HKObserverQueryCompletionHandler,
85                    *mut NSError,
86                ),
87            >,
88        ) -> Retained<Self>;
89    );
90}
91
92/// Methods declared on superclass `HKQuery`.
93#[cfg(feature = "HKQuery")]
94impl HKObserverQuery {
95    extern_methods!(
96        #[unsafe(method(init))]
97        #[unsafe(method_family = init)]
98        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
99    );
100}
101
102/// Methods declared on superclass `NSObject`.
103#[cfg(feature = "HKQuery")]
104impl HKObserverQuery {
105    extern_methods!(
106        #[unsafe(method(new))]
107        #[unsafe(method_family = new)]
108        pub unsafe fn new() -> Retained<Self>;
109    );
110}