objc2_contacts/generated/
CNContactVCardSerialization.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    /// Contact vCard support.
11    ///
12    ///
13    /// This converts between a contact and its vCard representation.
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/contacts/cncontactvcardserialization?language=objc)
16    #[unsafe(super(NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    pub struct CNContactVCardSerialization;
19);
20
21extern_conformance!(
22    unsafe impl NSObjectProtocol for CNContactVCardSerialization {}
23);
24
25impl CNContactVCardSerialization {
26    extern_methods!(
27        #[cfg(feature = "CNContact")]
28        /// Descriptor for all contact keys required by vCard serialization
29        ///
30        ///
31        /// This descriptor must be passed to the fetch request if the returned
32        /// contacts are to be serialized with dataWithContacts:error:.
33        #[unsafe(method(descriptorForRequiredKeys))]
34        #[unsafe(method_family = none)]
35        pub unsafe fn descriptorForRequiredKeys() -> Retained<ProtocolObject<dyn CNKeyDescriptor>>;
36
37        #[cfg(feature = "CNContact")]
38        /// Serialize contacts to data.
39        ///
40        ///
41        /// The contacts to be serialized must have been fetched with
42        /// `+descriptorForRequiredKeys.`
43        ///
44        /// Parameter `contacts`: The contacts to serialize.
45        ///
46        ///
47        /// Parameter `error`: An optional outparameter. If the serialization fails, this will be set.
48        ///
49        ///
50        /// Returns: The encoded data. If the serialization fails, this will be
51        /// `nil.`
52        #[unsafe(method(dataWithContacts:error:_))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn dataWithContacts_error(
55            contacts: &NSArray<CNContact>,
56        ) -> Result<Retained<NSData>, Retained<NSError>>;
57
58        #[cfg(feature = "CNContact")]
59        /// Parse data into contacts.
60        ///
61        ///
62        /// Parameter `data`: The data to parse.
63        ///
64        ///
65        /// Parameter `error`: An optional outparameter. If the parsing fails, this will be set.
66        ///
67        ///
68        /// Returns: The parsed contacts. If the parsing fails, this will be
69        /// `nil.`
70        #[unsafe(method(contactsWithData:error:_))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn contactsWithData_error(
73            data: &NSData,
74        ) -> Result<Retained<NSArray<CNContact>>, Retained<NSError>>;
75    );
76}
77
78/// Methods declared on superclass `NSObject`.
79impl CNContactVCardSerialization {
80    extern_methods!(
81        #[unsafe(method(init))]
82        #[unsafe(method_family = init)]
83        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
84
85        #[unsafe(method(new))]
86        #[unsafe(method_family = new)]
87        pub unsafe fn new() -> Retained<Self>;
88    );
89}