objc2_health_kit/generated/
HKActivitySummaryQuery.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/hkactivitysummaryquery?language=objc)
12    #[unsafe(super(HKQuery, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(feature = "HKQuery")]
15    pub struct HKActivitySummaryQuery;
16);
17
18#[cfg(feature = "HKQuery")]
19unsafe impl Send for HKActivitySummaryQuery {}
20
21#[cfg(feature = "HKQuery")]
22unsafe impl Sync for HKActivitySummaryQuery {}
23
24#[cfg(feature = "HKQuery")]
25extern_conformance!(
26    unsafe impl NSObjectProtocol for HKActivitySummaryQuery {}
27);
28
29#[cfg(feature = "HKQuery")]
30impl HKActivitySummaryQuery {
31    extern_methods!(
32        #[cfg(all(feature = "HKActivitySummary", feature = "block2"))]
33        /// An optional handler to be called when activity summaries matching the given predicate are updated.
34        ///
35        /// This property may not be modified once the query has been executed. If this property is nonnull, then
36        /// the query must be manually stopped.
37        ///
38        /// This property is not atomic.
39        ///
40        /// # Safety
41        ///
42        /// - The returned block must be sendable.
43        /// - This might not be thread-safe.
44        #[unsafe(method(updateHandler))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn updateHandler(
47            &self,
48        ) -> *mut block2::DynBlock<
49            dyn Fn(NonNull<HKActivitySummaryQuery>, *mut NSArray<HKActivitySummary>, *mut NSError),
50        >;
51
52        #[cfg(all(feature = "HKActivitySummary", feature = "block2"))]
53        /// Setter for [`updateHandler`][Self::updateHandler].
54        ///
55        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
56        ///
57        /// # Safety
58        ///
59        /// - `update_handler` block must be sendable.
60        /// - This might not be thread-safe.
61        #[unsafe(method(setUpdateHandler:))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn setUpdateHandler(
64            &self,
65            update_handler: Option<
66                &block2::DynBlock<
67                    dyn Fn(
68                        NonNull<HKActivitySummaryQuery>,
69                        *mut NSArray<HKActivitySummary>,
70                        *mut NSError,
71                    ),
72                >,
73            >,
74        );
75
76        #[cfg(all(feature = "HKActivitySummary", feature = "block2"))]
77        /// Returns a query that will retrieve HKActivitySummaries matching the given predicate.
78        ///
79        /// If no updateHandler is set on the query, the query will automatically stop after calling resultsHandler.
80        /// Otherwise, the query continues to run and calls the updateHandler as HKActivitySummaries matching the
81        /// predicate are updated.
82        ///
83        /// Parameter `predicate`: The predicate which HKActivitySummaries should match.
84        ///
85        /// Parameter `handler`: The block to invoke with results when the query has finished.
86        ///
87        /// # Safety
88        ///
89        /// `handler` block must be sendable.
90        #[unsafe(method(initWithPredicate:resultsHandler:))]
91        #[unsafe(method_family = init)]
92        pub unsafe fn initWithPredicate_resultsHandler(
93            this: Allocated<Self>,
94            predicate: Option<&NSPredicate>,
95            handler: &block2::DynBlock<
96                dyn Fn(
97                    NonNull<HKActivitySummaryQuery>,
98                    *mut NSArray<HKActivitySummary>,
99                    *mut NSError,
100                ),
101            >,
102        ) -> Retained<Self>;
103    );
104}
105
106/// Methods declared on superclass `HKQuery`.
107#[cfg(feature = "HKQuery")]
108impl HKActivitySummaryQuery {
109    extern_methods!(
110        #[unsafe(method(init))]
111        #[unsafe(method_family = init)]
112        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
113    );
114}
115
116/// Methods declared on superclass `NSObject`.
117#[cfg(feature = "HKQuery")]
118impl HKActivitySummaryQuery {
119    extern_methods!(
120        #[unsafe(method(new))]
121        #[unsafe(method_family = new)]
122        pub unsafe fn new() -> Retained<Self>;
123    );
124}