objc2_health_kit/generated/
HKVisionPrescription.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
9/// Represents a vision prescription type
10///
11/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkvisionprescriptiontype?language=objc)
12// NS_ENUM
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct HKVisionPrescriptionType(pub NSUInteger);
16impl HKVisionPrescriptionType {
17    #[doc(alias = "HKVisionPrescriptionTypeGlasses")]
18    pub const Glasses: Self = Self(1);
19    #[doc(alias = "HKVisionPrescriptionTypeContacts")]
20    pub const Contacts: Self = Self(2);
21}
22
23unsafe impl Encode for HKVisionPrescriptionType {
24    const ENCODING: Encoding = NSUInteger::ENCODING;
25}
26
27unsafe impl RefEncode for HKVisionPrescriptionType {
28    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
29}
30
31extern_class!(
32    /// HKSample subclass representing a vision prescription
33    ///
34    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkvisionprescription?language=objc)
35    #[unsafe(super(HKSample, HKObject, NSObject))]
36    #[derive(Debug, PartialEq, Eq, Hash)]
37    #[cfg(all(feature = "HKObject", feature = "HKSample"))]
38    pub struct HKVisionPrescription;
39);
40
41#[cfg(all(feature = "HKObject", feature = "HKSample"))]
42unsafe impl Send for HKVisionPrescription {}
43
44#[cfg(all(feature = "HKObject", feature = "HKSample"))]
45unsafe impl Sync for HKVisionPrescription {}
46
47#[cfg(all(feature = "HKObject", feature = "HKSample"))]
48extern_conformance!(
49    unsafe impl NSCoding for HKVisionPrescription {}
50);
51
52#[cfg(all(feature = "HKObject", feature = "HKSample"))]
53extern_conformance!(
54    unsafe impl NSCopying for HKVisionPrescription {}
55);
56
57#[cfg(all(feature = "HKObject", feature = "HKSample"))]
58unsafe impl CopyingHelper for HKVisionPrescription {
59    type Result = Self;
60}
61
62#[cfg(all(feature = "HKObject", feature = "HKSample"))]
63extern_conformance!(
64    unsafe impl NSObjectProtocol for HKVisionPrescription {}
65);
66
67#[cfg(all(feature = "HKObject", feature = "HKSample"))]
68extern_conformance!(
69    unsafe impl NSSecureCoding for HKVisionPrescription {}
70);
71
72#[cfg(all(feature = "HKObject", feature = "HKSample"))]
73impl HKVisionPrescription {
74    extern_methods!(
75        /// A vision prescription type (glasses or contacts)
76        ///
77        /// This property is not atomic.
78        ///
79        /// # Safety
80        ///
81        /// This might not be thread-safe.
82        #[unsafe(method(prescriptionType))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn prescriptionType(&self) -> HKVisionPrescriptionType;
85
86        /// The date the prescription was issued
87        ///
88        /// This property is not atomic.
89        ///
90        /// # Safety
91        ///
92        /// This might not be thread-safe.
93        #[unsafe(method(dateIssued))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn dateIssued(&self) -> Retained<NSDate>;
96
97        /// The date the prescription will expire
98        ///
99        /// This property is not atomic.
100        ///
101        /// # Safety
102        ///
103        /// This might not be thread-safe.
104        #[unsafe(method(expirationDate))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn expirationDate(&self) -> Option<Retained<NSDate>>;
107
108        #[cfg(feature = "HKDevice")]
109        /// Parameter `type`: The prescription type
110        ///
111        /// Parameter `dateIssued`: The date the prescription was issued
112        ///
113        /// Parameter `expirationDate`: The date the prescription expires
114        ///
115        /// Parameter `device`: The device that generated the sample
116        ///
117        /// Parameter `metadata`: The metadata for the sample
118        ///
119        /// # Safety
120        ///
121        /// `metadata` generic should be of the correct type.
122        #[unsafe(method(prescriptionWithType:dateIssued:expirationDate:device:metadata:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn prescriptionWithType_dateIssued_expirationDate_device_metadata(
125            r#type: HKVisionPrescriptionType,
126            date_issued: &NSDate,
127            expiration_date: Option<&NSDate>,
128            device: Option<&HKDevice>,
129            metadata: Option<&NSDictionary<NSString, AnyObject>>,
130        ) -> Retained<Self>;
131
132        #[unsafe(method(init))]
133        #[unsafe(method_family = init)]
134        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
135
136        #[unsafe(method(new))]
137        #[unsafe(method_family = new)]
138        pub unsafe fn new() -> Retained<Self>;
139    );
140}