objc2_contacts/generated/
CNLabeledValue.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    /// A contact property that has a value and label.
11    ///
12    /// See also [Apple's documentation](https://developer.apple.com/documentation/contacts/cnlabeledvalue?language=objc)
13    #[unsafe(super(NSObject))]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct CNLabeledValue<ValueType: ?Sized = AnyObject>;
16);
17
18impl<ValueType: ?Sized + Message + NSCopying + NSSecureCoding> CNLabeledValue<ValueType> {
19    /// Unchecked conversion of the generic parameter.
20    ///
21    /// # Safety
22    ///
23    /// The generic must be valid to reinterpret as the given type.
24    #[inline]
25    pub unsafe fn cast_unchecked<NewValueType: ?Sized + Message + NSCopying + NSSecureCoding>(
26        &self,
27    ) -> &CNLabeledValue<NewValueType> {
28        unsafe { &*((self as *const Self).cast()) }
29    }
30}
31
32extern_conformance!(
33    unsafe impl<ValueType: ?Sized + NSCoding + NSCopying + NSSecureCoding> NSCoding
34        for CNLabeledValue<ValueType>
35    {
36    }
37);
38
39extern_conformance!(
40    unsafe impl<ValueType: ?Sized + NSCopying + NSSecureCoding> NSCopying
41        for CNLabeledValue<ValueType>
42    {
43    }
44);
45
46unsafe impl<ValueType: ?Sized + Message + NSCopying + NSSecureCoding> CopyingHelper
47    for CNLabeledValue<ValueType>
48{
49    type Result = Self;
50}
51
52extern_conformance!(
53    unsafe impl<ValueType: ?Sized + NSCopying + NSSecureCoding> NSObjectProtocol
54        for CNLabeledValue<ValueType>
55    {
56    }
57);
58
59extern_conformance!(
60    unsafe impl<ValueType: ?Sized + NSSecureCoding + NSCopying + NSSecureCoding> NSSecureCoding
61        for CNLabeledValue<ValueType>
62    {
63    }
64);
65
66impl<ValueType: Message + NSCopying + NSSecureCoding> CNLabeledValue<ValueType> {
67    extern_methods!(
68        /// The identifier is unique among contacts on the device. It can be saved and used for finding labeled values next application launch.
69        #[unsafe(method(identifier))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn identifier(&self) -> Retained<NSString>;
72
73        #[unsafe(method(label))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn label(&self) -> Option<Retained<NSString>>;
76
77        #[unsafe(method(value))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn value(&self) -> Retained<ValueType>;
80
81        /// Returns a new CNLabeledValue with a new identifier.
82        #[unsafe(method(labeledValueWithLabel:value:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn labeledValueWithLabel_value(
85            label: Option<&NSString>,
86            value: &ValueType,
87        ) -> Retained<Self>;
88
89        /// Initializes the CNLabeledValue with a new identifier.
90        #[unsafe(method(initWithLabel:value:))]
91        #[unsafe(method_family = init)]
92        pub unsafe fn initWithLabel_value(
93            this: Allocated<Self>,
94            label: Option<&NSString>,
95            value: &ValueType,
96        ) -> Retained<Self>;
97
98        /// Returns a new CNLabeledValue with the existing value and identifier.
99        #[unsafe(method(labeledValueBySettingLabel:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn labeledValueBySettingLabel(&self, label: Option<&NSString>)
102            -> Retained<Self>;
103
104        /// Returns a new CNLabeledValue with the existing label and identifier.
105        #[unsafe(method(labeledValueBySettingValue:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn labeledValueBySettingValue(&self, value: &ValueType) -> Retained<Self>;
108
109        /// Returns a new CNLabeledValue with the existing identifier.
110        #[unsafe(method(labeledValueBySettingLabel:value:))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn labeledValueBySettingLabel_value(
113            &self,
114            label: Option<&NSString>,
115            value: &ValueType,
116        ) -> Retained<Self>;
117
118        /// Get a localized label.
119        ///
120        ///
121        /// Some labels are special keys representing generic labels. Use this to obtain a localized string for a label to display to a user.
122        ///
123        ///
124        /// Parameter `label`: to localize.
125        ///
126        /// Returns: The localized string if a Contacts framework defined label, otherwise just returns the label.
127        #[unsafe(method(localizedStringForLabel:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn localizedStringForLabel(label: &NSString) -> Retained<NSString>;
130    );
131}
132
133/// Methods declared on superclass `NSObject`.
134impl<ValueType: Message + NSCopying + NSSecureCoding> CNLabeledValue<ValueType> {
135    extern_methods!(
136        #[unsafe(method(init))]
137        #[unsafe(method_family = init)]
138        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
139
140        #[unsafe(method(new))]
141        #[unsafe(method_family = new)]
142        pub unsafe fn new() -> Retained<Self>;
143    );
144}
145
146extern "C" {
147    /// [Apple's documentation](https://developer.apple.com/documentation/contacts/cnlabelhome?language=objc)
148    pub static CNLabelHome: &'static NSString;
149}
150
151extern "C" {
152    /// [Apple's documentation](https://developer.apple.com/documentation/contacts/cnlabelwork?language=objc)
153    pub static CNLabelWork: &'static NSString;
154}
155
156extern "C" {
157    /// [Apple's documentation](https://developer.apple.com/documentation/contacts/cnlabelschool?language=objc)
158    pub static CNLabelSchool: &'static NSString;
159}
160
161extern "C" {
162    /// [Apple's documentation](https://developer.apple.com/documentation/contacts/cnlabelother?language=objc)
163    pub static CNLabelOther: &'static NSString;
164}
165
166extern "C" {
167    /// [Apple's documentation](https://developer.apple.com/documentation/contacts/cnlabelemailicloud?language=objc)
168    pub static CNLabelEmailiCloud: &'static NSString;
169}
170
171extern "C" {
172    /// [Apple's documentation](https://developer.apple.com/documentation/contacts/cnlabelurladdresshomepage?language=objc)
173    pub static CNLabelURLAddressHomePage: &'static NSString;
174}
175
176extern "C" {
177    /// [Apple's documentation](https://developer.apple.com/documentation/contacts/cnlabeldateanniversary?language=objc)
178    pub static CNLabelDateAnniversary: &'static NSString;
179}