objc2_health_kit/generated/
HKWorkoutEffortRelationshipQuery.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/hkworkouteffortrelationship?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct HKWorkoutEffortRelationship;
15);
16
17unsafe impl Send for HKWorkoutEffortRelationship {}
18
19unsafe impl Sync for HKWorkoutEffortRelationship {}
20
21extern_conformance!(
22    unsafe impl NSCoding for HKWorkoutEffortRelationship {}
23);
24
25extern_conformance!(
26    unsafe impl NSCopying for HKWorkoutEffortRelationship {}
27);
28
29unsafe impl CopyingHelper for HKWorkoutEffortRelationship {
30    type Result = Self;
31}
32
33extern_conformance!(
34    unsafe impl NSObjectProtocol for HKWorkoutEffortRelationship {}
35);
36
37extern_conformance!(
38    unsafe impl NSSecureCoding for HKWorkoutEffortRelationship {}
39);
40
41impl HKWorkoutEffortRelationship {
42    extern_methods!(
43        #[cfg(all(feature = "HKObject", feature = "HKSample", feature = "HKWorkout"))]
44        /// This property is not atomic.
45        ///
46        /// # Safety
47        ///
48        /// This might not be thread-safe.
49        #[unsafe(method(workout))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn workout(&self) -> Retained<HKWorkout>;
52
53        #[cfg(feature = "HKWorkoutActivity")]
54        /// This property is not atomic.
55        ///
56        /// # Safety
57        ///
58        /// This might not be thread-safe.
59        #[unsafe(method(activity))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn activity(&self) -> Option<Retained<HKWorkoutActivity>>;
62
63        #[cfg(all(feature = "HKObject", feature = "HKSample"))]
64        /// The samples related to the workout but not any sub-activities
65        ///
66        /// This property is not atomic.
67        ///
68        /// # Safety
69        ///
70        /// This might not be thread-safe.
71        #[unsafe(method(samples))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn samples(&self) -> Option<Retained<NSArray<HKSample>>>;
74    );
75}
76
77/// Methods declared on superclass `NSObject`.
78impl HKWorkoutEffortRelationship {
79    extern_methods!(
80        #[unsafe(method(init))]
81        #[unsafe(method_family = init)]
82        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
83
84        #[unsafe(method(new))]
85        #[unsafe(method_family = new)]
86        pub unsafe fn new() -> Retained<Self>;
87    );
88}
89
90/// Option for specifying which workout effort relationship sample(s) to retrieve
91///
92/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkouteffortrelationshipqueryoptions?language=objc)
93// NS_ENUM
94#[repr(transparent)]
95#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
96pub struct HKWorkoutEffortRelationshipQueryOptions(pub NSInteger);
97impl HKWorkoutEffortRelationshipQueryOptions {
98    #[doc(alias = "HKWorkoutEffortRelationshipQueryOptionsDefault")]
99    pub const Default: Self = Self(0);
100    #[doc(alias = "HKWorkoutEffortRelationshipQueryOptionsMostRelevant")]
101    pub const MostRelevant: Self = Self(1 << 0);
102}
103
104unsafe impl Encode for HKWorkoutEffortRelationshipQueryOptions {
105    const ENCODING: Encoding = NSInteger::ENCODING;
106}
107
108unsafe impl RefEncode for HKWorkoutEffortRelationshipQueryOptions {
109    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
110}
111
112extern_class!(
113    /// A concrete subclass of HKQuery that provides an interface to observe associations with a workout sample.
114    ///
115    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkouteffortrelationshipquery?language=objc)
116    #[unsafe(super(HKQuery, NSObject))]
117    #[derive(Debug, PartialEq, Eq, Hash)]
118    #[cfg(feature = "HKQuery")]
119    pub struct HKWorkoutEffortRelationshipQuery;
120);
121
122#[cfg(feature = "HKQuery")]
123unsafe impl Send for HKWorkoutEffortRelationshipQuery {}
124
125#[cfg(feature = "HKQuery")]
126unsafe impl Sync for HKWorkoutEffortRelationshipQuery {}
127
128#[cfg(feature = "HKQuery")]
129extern_conformance!(
130    unsafe impl NSObjectProtocol for HKWorkoutEffortRelationshipQuery {}
131);
132
133#[cfg(feature = "HKQuery")]
134impl HKWorkoutEffortRelationshipQuery {
135    extern_methods!(
136        #[cfg(all(feature = "HKQueryAnchor", feature = "block2"))]
137        /// Returns a query that will retrieve HKWorkoutEffortRelationship matching the given predicate that are
138        /// newer than the given anchor.
139        ///
140        /// This is a long running query and it is the responsibility of the caller to stop the query
141        /// after they have received the results they desire.
142        /// The first call to resultsHandler will contain the inital results which may be empty and future callbacks
143        /// will contain new relationships as well as any changes to previous relationships along with a new anchor
144        ///
145        /// Parameter `predicate`: The predicate on the workout(s) which samples should match.
146        ///
147        /// Parameter `anchor`: The anchor which was returned by a previous HKWorkoutEffortRelationshipQuery result or update
148        /// handler.  Pass nil when querying for the first time.
149        ///
150        /// Parameter `options`: The options for the query, one of types from `HKWorkoutEffortRelationshipQueryOptions`
151        ///
152        /// Parameter `resultsHandler`: The block to invoke with related sample results
153        ///
154        /// # Safety
155        ///
156        /// `results_handler` block must be sendable.
157        #[unsafe(method(initWithPredicate:anchor:options:resultsHandler:))]
158        #[unsafe(method_family = init)]
159        pub unsafe fn initWithPredicate_anchor_options_resultsHandler(
160            this: Allocated<Self>,
161            predicate: Option<&NSPredicate>,
162            anchor: Option<&HKQueryAnchor>,
163            options: HKWorkoutEffortRelationshipQueryOptions,
164            results_handler: &block2::DynBlock<
165                dyn Fn(
166                    NonNull<HKWorkoutEffortRelationshipQuery>,
167                    *mut NSArray<HKWorkoutEffortRelationship>,
168                    *mut HKQueryAnchor,
169                    *mut NSError,
170                ),
171            >,
172        ) -> Retained<Self>;
173    );
174}
175
176/// Methods declared on superclass `HKQuery`.
177#[cfg(feature = "HKQuery")]
178impl HKWorkoutEffortRelationshipQuery {
179    extern_methods!(
180        #[unsafe(method(init))]
181        #[unsafe(method_family = init)]
182        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
183    );
184}
185
186/// Methods declared on superclass `NSObject`.
187#[cfg(feature = "HKQuery")]
188impl HKWorkoutEffortRelationshipQuery {
189    extern_methods!(
190        #[unsafe(method(new))]
191        #[unsafe(method_family = new)]
192        pub unsafe fn new() -> Retained<Self>;
193    );
194}