objc2_cloud_kit/generated/
CKReference.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/// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckreferenceaction?language=objc)
10// NS_ENUM
11#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct CKReferenceAction(pub NSUInteger);
14impl CKReferenceAction {
15    #[doc(alias = "CKReferenceActionNone")]
16    pub const None: Self = Self(0);
17    #[doc(alias = "CKReferenceActionDeleteSelf")]
18    pub const DeleteSelf: Self = Self(1);
19}
20
21unsafe impl Encode for CKReferenceAction {
22    const ENCODING: Encoding = NSUInteger::ENCODING;
23}
24
25unsafe impl RefEncode for CKReferenceAction {
26    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
27}
28
29extern_class!(
30    /// [Apple's documentation](https://developer.apple.com/documentation/cloudkit/ckreference?language=objc)
31    #[unsafe(super(NSObject))]
32    #[derive(Debug, PartialEq, Eq, Hash)]
33    pub struct CKReference;
34);
35
36unsafe impl Send for CKReference {}
37
38unsafe impl Sync for CKReference {}
39
40extern_conformance!(
41    unsafe impl NSCoding for CKReference {}
42);
43
44extern_conformance!(
45    unsafe impl NSCopying for CKReference {}
46);
47
48unsafe impl CopyingHelper for CKReference {
49    type Result = Self;
50}
51
52extern_conformance!(
53    unsafe impl NSObjectProtocol for CKReference {}
54);
55
56extern_conformance!(
57    unsafe impl NSSecureCoding for CKReference {}
58);
59
60impl CKReference {
61    extern_methods!(
62        #[unsafe(method(init))]
63        #[unsafe(method_family = init)]
64        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
65
66        #[unsafe(method(new))]
67        #[unsafe(method_family = new)]
68        pub unsafe fn new() -> Retained<Self>;
69
70        #[cfg(feature = "CKRecordID")]
71        /// It is acceptable to relate two records that have not yet been uploaded to the server. Those records must be uploaded to the server in the same operation if using an action other than `CKReferenceActionNone`.
72        ///
73        /// If a record references a record that does not exist on the server and is not in the current save operation it will result in an error if using an action other than `CKReferenceActionNone`.
74        #[unsafe(method(initWithRecordID:action:))]
75        #[unsafe(method_family = init)]
76        pub unsafe fn initWithRecordID_action(
77            this: Allocated<Self>,
78            record_id: &CKRecordID,
79            action: CKReferenceAction,
80        ) -> Retained<Self>;
81
82        #[cfg(feature = "CKRecord")]
83        #[unsafe(method(initWithRecord:action:))]
84        #[unsafe(method_family = init)]
85        pub unsafe fn initWithRecord_action(
86            this: Allocated<Self>,
87            record: &CKRecord,
88            action: CKReferenceAction,
89        ) -> Retained<Self>;
90
91        /// This property is not atomic.
92        ///
93        /// # Safety
94        ///
95        /// This might not be thread-safe.
96        #[unsafe(method(referenceAction))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn referenceAction(&self) -> CKReferenceAction;
99
100        #[cfg(feature = "CKRecordID")]
101        /// This property is not atomic.
102        ///
103        /// # Safety
104        ///
105        /// This might not be thread-safe.
106        #[unsafe(method(recordID))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn recordID(&self) -> Retained<CKRecordID>;
109    );
110}