objc2_health_kit/generated/
HKQuantitySample.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 abstract HKSample subclass representing a quantity measurement.
11    ///
12    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkquantitysample?language=objc)
13    #[unsafe(super(HKSample, HKObject, NSObject))]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    #[cfg(all(feature = "HKObject", feature = "HKSample"))]
16    pub struct HKQuantitySample;
17);
18
19#[cfg(all(feature = "HKObject", feature = "HKSample"))]
20unsafe impl Send for HKQuantitySample {}
21
22#[cfg(all(feature = "HKObject", feature = "HKSample"))]
23unsafe impl Sync for HKQuantitySample {}
24
25#[cfg(all(feature = "HKObject", feature = "HKSample"))]
26extern_conformance!(
27    unsafe impl NSCoding for HKQuantitySample {}
28);
29
30#[cfg(all(feature = "HKObject", feature = "HKSample"))]
31extern_conformance!(
32    unsafe impl NSObjectProtocol for HKQuantitySample {}
33);
34
35#[cfg(all(feature = "HKObject", feature = "HKSample"))]
36extern_conformance!(
37    unsafe impl NSSecureCoding for HKQuantitySample {}
38);
39
40#[cfg(all(feature = "HKObject", feature = "HKSample"))]
41impl HKQuantitySample {
42    extern_methods!(
43        #[cfg(feature = "HKObjectType")]
44        #[unsafe(method(quantityType))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn quantityType(&self) -> Retained<HKQuantityType>;
47
48        #[cfg(feature = "HKQuantity")]
49        #[unsafe(method(quantity))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn quantity(&self) -> Retained<HKQuantity>;
52
53        /// The number of individual values making up the receiver's quantity.
54        ///
55        /// Requests for the individual series quantities can be made using HKQuantitySeriesSampleQuery.
56        #[unsafe(method(count))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn count(&self) -> NSInteger;
59
60        #[cfg(all(feature = "HKObjectType", feature = "HKQuantity"))]
61        /// Creates a new HKQuantitySample with the given type, quantity, start date, and end date.
62        ///
63        /// The quantity must have a unit that is compatible with the given quantity type.
64        /// See -[HKQuantityType isCompatibleWithUnit:].
65        #[unsafe(method(quantitySampleWithType:quantity:startDate:endDate:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn quantitySampleWithType_quantity_startDate_endDate(
68            quantity_type: &HKQuantityType,
69            quantity: &HKQuantity,
70            start_date: &NSDate,
71            end_date: &NSDate,
72        ) -> Retained<Self>;
73
74        #[cfg(all(feature = "HKObjectType", feature = "HKQuantity"))]
75        /// Creates a new HKQuantitySample with the given type, quantity, start date, end date, and metadata.
76        ///
77        /// The quantity must have a unit that is compatible with the given quantity type.
78        /// See -[HKQuantityType isCompatibleWithUnit:].
79        ///
80        /// # Safety
81        ///
82        /// `metadata` generic should be of the correct type.
83        #[unsafe(method(quantitySampleWithType:quantity:startDate:endDate:metadata:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn quantitySampleWithType_quantity_startDate_endDate_metadata(
86            quantity_type: &HKQuantityType,
87            quantity: &HKQuantity,
88            start_date: &NSDate,
89            end_date: &NSDate,
90            metadata: Option<&NSDictionary<NSString, AnyObject>>,
91        ) -> Retained<Self>;
92
93        #[cfg(all(feature = "HKDevice", feature = "HKObjectType", feature = "HKQuantity"))]
94        /// Creates a new HKQuantitySample with the given type, quantity, start date, end date, and metadata.
95        ///
96        /// Parameter `quantityType`: The type of the sample.
97        ///
98        /// Parameter `startDate`: The start date of the sample.
99        ///
100        /// Parameter `endDate`: The end date of the sample.
101        ///
102        /// Parameter `device`: The HKDevice that generated the sample (optional).
103        ///
104        /// Parameter `metadata`: Metadata for the sample (optional).
105        ///
106        /// The quantity must have a unit that is compatible with the given quantity type.
107        /// See -[HKQuantityType isCompatibleWithUnit:].
108        ///
109        /// # Safety
110        ///
111        /// `metadata` generic should be of the correct type.
112        #[unsafe(method(quantitySampleWithType:quantity:startDate:endDate:device:metadata:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn quantitySampleWithType_quantity_startDate_endDate_device_metadata(
115            quantity_type: &HKQuantityType,
116            quantity: &HKQuantity,
117            start_date: &NSDate,
118            end_date: &NSDate,
119            device: Option<&HKDevice>,
120            metadata: Option<&NSDictionary<NSString, AnyObject>>,
121        ) -> Retained<Self>;
122    );
123}
124
125/// Methods declared on superclass `HKObject`.
126#[cfg(all(feature = "HKObject", feature = "HKSample"))]
127impl HKQuantitySample {
128    extern_methods!(
129        #[unsafe(method(init))]
130        #[unsafe(method_family = init)]
131        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
132    );
133}
134
135/// Methods declared on superclass `NSObject`.
136#[cfg(all(feature = "HKObject", feature = "HKSample"))]
137impl HKQuantitySample {
138    extern_methods!(
139        #[unsafe(method(new))]
140        #[unsafe(method_family = new)]
141        pub unsafe fn new() -> Retained<Self>;
142    );
143}
144
145extern "C" {
146    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathquantity?language=objc)
147    pub static HKPredicateKeyPathQuantity: &'static NSString;
148}
149
150extern "C" {
151    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathcount?language=objc)
152    pub static HKPredicateKeyPathCount: &'static NSString;
153}