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
40unsafe impl NSCoding for CKReference {}
41
42unsafe impl NSCopying for CKReference {}
43
44unsafe impl CopyingHelper for CKReference {
45    type Result = Self;
46}
47
48unsafe impl NSObjectProtocol for CKReference {}
49
50unsafe impl NSSecureCoding for CKReference {}
51
52impl CKReference {
53    extern_methods!(
54        #[unsafe(method(init))]
55        #[unsafe(method_family = init)]
56        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
57
58        #[unsafe(method(new))]
59        #[unsafe(method_family = new)]
60        pub unsafe fn new() -> Retained<Self>;
61
62        #[cfg(feature = "CKRecordID")]
63        /// 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`.
64        ///
65        /// 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`.
66        #[unsafe(method(initWithRecordID:action:))]
67        #[unsafe(method_family = init)]
68        pub unsafe fn initWithRecordID_action(
69            this: Allocated<Self>,
70            record_id: &CKRecordID,
71            action: CKReferenceAction,
72        ) -> Retained<Self>;
73
74        #[cfg(feature = "CKRecord")]
75        #[unsafe(method(initWithRecord:action:))]
76        #[unsafe(method_family = init)]
77        pub unsafe fn initWithRecord_action(
78            this: Allocated<Self>,
79            record: &CKRecord,
80            action: CKReferenceAction,
81        ) -> Retained<Self>;
82
83        #[unsafe(method(referenceAction))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn referenceAction(&self) -> CKReferenceAction;
86
87        #[cfg(feature = "CKRecordID")]
88        #[unsafe(method(recordID))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn recordID(&self) -> Retained<CKRecordID>;
91    );
92}