objc2_health_kit/generated/
HKCumulativeQuantitySample.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10    /// An HKQuantitySample subclass representing a quantity measurement with cumulative aggregation style.
11    ///
12    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkcumulativequantitysample?language=objc)
13    #[unsafe(super(HKQuantitySample, HKSample, HKObject, NSObject))]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    #[cfg(all(
16        feature = "HKObject",
17        feature = "HKQuantitySample",
18        feature = "HKSample"
19    ))]
20    pub struct HKCumulativeQuantitySample;
21);
22
23#[cfg(all(
24    feature = "HKObject",
25    feature = "HKQuantitySample",
26    feature = "HKSample"
27))]
28unsafe impl Send for HKCumulativeQuantitySample {}
29
30#[cfg(all(
31    feature = "HKObject",
32    feature = "HKQuantitySample",
33    feature = "HKSample"
34))]
35unsafe impl Sync for HKCumulativeQuantitySample {}
36
37#[cfg(all(
38    feature = "HKObject",
39    feature = "HKQuantitySample",
40    feature = "HKSample"
41))]
42extern_conformance!(
43    unsafe impl NSCoding for HKCumulativeQuantitySample {}
44);
45
46#[cfg(all(
47    feature = "HKObject",
48    feature = "HKQuantitySample",
49    feature = "HKSample"
50))]
51extern_conformance!(
52    unsafe impl NSObjectProtocol for HKCumulativeQuantitySample {}
53);
54
55#[cfg(all(
56    feature = "HKObject",
57    feature = "HKQuantitySample",
58    feature = "HKSample"
59))]
60extern_conformance!(
61    unsafe impl NSSecureCoding for HKCumulativeQuantitySample {}
62);
63
64#[cfg(all(
65    feature = "HKObject",
66    feature = "HKQuantitySample",
67    feature = "HKSample"
68))]
69impl HKCumulativeQuantitySample {
70    extern_methods!(
71        #[cfg(feature = "HKQuantity")]
72        /// The sum of quantities represented by the receiver.
73        #[unsafe(method(sumQuantity))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn sumQuantity(&self) -> Retained<HKQuantity>;
76    );
77}
78
79/// Methods declared on superclass `HKQuantitySample`.
80#[cfg(all(
81    feature = "HKObject",
82    feature = "HKQuantitySample",
83    feature = "HKSample"
84))]
85impl HKCumulativeQuantitySample {
86    extern_methods!(
87        #[cfg(all(feature = "HKObjectType", feature = "HKQuantity"))]
88        /// Creates a new HKQuantitySample with the given type, quantity, start date, and end date.
89        ///
90        /// The quantity must have a unit that is compatible with the given quantity type.
91        /// See -[HKQuantityType isCompatibleWithUnit:].
92        #[unsafe(method(quantitySampleWithType:quantity:startDate:endDate:))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn quantitySampleWithType_quantity_startDate_endDate(
95            quantity_type: &HKQuantityType,
96            quantity: &HKQuantity,
97            start_date: &NSDate,
98            end_date: &NSDate,
99        ) -> Retained<Self>;
100
101        #[cfg(all(feature = "HKObjectType", feature = "HKQuantity"))]
102        /// Creates a new HKQuantitySample with the given type, quantity, start date, end date, and metadata.
103        ///
104        /// The quantity must have a unit that is compatible with the given quantity type.
105        /// See -[HKQuantityType isCompatibleWithUnit:].
106        ///
107        /// # Safety
108        ///
109        /// `metadata` generic should be of the correct type.
110        #[unsafe(method(quantitySampleWithType:quantity:startDate:endDate:metadata:))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn quantitySampleWithType_quantity_startDate_endDate_metadata(
113            quantity_type: &HKQuantityType,
114            quantity: &HKQuantity,
115            start_date: &NSDate,
116            end_date: &NSDate,
117            metadata: Option<&NSDictionary<NSString, AnyObject>>,
118        ) -> Retained<Self>;
119
120        #[cfg(all(feature = "HKDevice", feature = "HKObjectType", feature = "HKQuantity"))]
121        /// Creates a new HKQuantitySample with the given type, quantity, start date, end date, and metadata.
122        ///
123        /// Parameter `quantityType`: The type of the sample.
124        ///
125        /// Parameter `startDate`: The start date of the sample.
126        ///
127        /// Parameter `endDate`: The end date of the sample.
128        ///
129        /// Parameter `device`: The HKDevice that generated the sample (optional).
130        ///
131        /// Parameter `metadata`: Metadata for the sample (optional).
132        ///
133        /// The quantity must have a unit that is compatible with the given quantity type.
134        /// See -[HKQuantityType isCompatibleWithUnit:].
135        ///
136        /// # Safety
137        ///
138        /// `metadata` generic should be of the correct type.
139        #[unsafe(method(quantitySampleWithType:quantity:startDate:endDate:device:metadata:))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn quantitySampleWithType_quantity_startDate_endDate_device_metadata(
142            quantity_type: &HKQuantityType,
143            quantity: &HKQuantity,
144            start_date: &NSDate,
145            end_date: &NSDate,
146            device: Option<&HKDevice>,
147            metadata: Option<&NSDictionary<NSString, AnyObject>>,
148        ) -> Retained<Self>;
149    );
150}
151
152/// Methods declared on superclass `HKObject`.
153#[cfg(all(
154    feature = "HKObject",
155    feature = "HKQuantitySample",
156    feature = "HKSample"
157))]
158impl HKCumulativeQuantitySample {
159    extern_methods!(
160        #[unsafe(method(init))]
161        #[unsafe(method_family = init)]
162        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
163    );
164}
165
166/// Methods declared on superclass `NSObject`.
167#[cfg(all(
168    feature = "HKObject",
169    feature = "HKQuantitySample",
170    feature = "HKSample"
171))]
172impl HKCumulativeQuantitySample {
173    extern_methods!(
174        #[unsafe(method(new))]
175        #[unsafe(method_family = new)]
176        pub unsafe fn new() -> Retained<Self>;
177    );
178}
179
180extern "C" {
181    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathsum?language=objc)
182    pub static HKPredicateKeyPathSum: &'static NSString;
183}