objc2_core_data/generated/
NSPersistentCloudKitContainer.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::*;
5#[cfg(feature = "objc2-cloud-kit")]
6use objc2_cloud_kit::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11/// [Apple's documentation](https://developer.apple.com/documentation/coredata/nspersistentcloudkitcontainerschemainitializationoptions?language=objc)
12// NS_OPTIONS
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct NSPersistentCloudKitContainerSchemaInitializationOptions(pub NSUInteger);
16bitflags::bitflags! {
17    impl NSPersistentCloudKitContainerSchemaInitializationOptions: NSUInteger {
18        #[doc(alias = "NSPersistentCloudKitContainerSchemaInitializationOptionsNone")]
19        const None = 0;
20        #[doc(alias = "NSPersistentCloudKitContainerSchemaInitializationOptionsDryRun")]
21        const DryRun = 1<<1;
22        #[doc(alias = "NSPersistentCloudKitContainerSchemaInitializationOptionsPrintSchema")]
23        const PrintSchema = 1<<2;
24    }
25}
26
27unsafe impl Encode for NSPersistentCloudKitContainerSchemaInitializationOptions {
28    const ENCODING: Encoding = NSUInteger::ENCODING;
29}
30
31unsafe impl RefEncode for NSPersistentCloudKitContainerSchemaInitializationOptions {
32    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35extern_class!(
36    /// [Apple's documentation](https://developer.apple.com/documentation/coredata/nspersistentcloudkitcontainer?language=objc)
37    #[unsafe(super(NSPersistentContainer, NSObject))]
38    #[derive(Debug, PartialEq, Eq, Hash)]
39    #[cfg(feature = "NSPersistentContainer")]
40    pub struct NSPersistentCloudKitContainer;
41);
42
43#[cfg(feature = "NSPersistentContainer")]
44unsafe impl Send for NSPersistentCloudKitContainer {}
45
46#[cfg(feature = "NSPersistentContainer")]
47unsafe impl Sync for NSPersistentCloudKitContainer {}
48
49#[cfg(feature = "NSPersistentContainer")]
50extern_conformance!(
51    unsafe impl NSObjectProtocol for NSPersistentCloudKitContainer {}
52);
53
54#[cfg(feature = "NSPersistentContainer")]
55impl NSPersistentCloudKitContainer {
56    extern_methods!(
57        #[unsafe(method(initializeCloudKitSchemaWithOptions:error:_))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn initializeCloudKitSchemaWithOptions_error(
60            &self,
61            options: NSPersistentCloudKitContainerSchemaInitializationOptions,
62        ) -> Result<(), Retained<NSError>>;
63
64        #[cfg(all(feature = "NSManagedObjectID", feature = "objc2-cloud-kit"))]
65        #[unsafe(method(recordForManagedObjectID:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn recordForManagedObjectID(
68            &self,
69            managed_object_id: &NSManagedObjectID,
70        ) -> Option<Retained<CKRecord>>;
71
72        #[cfg(all(feature = "NSManagedObjectID", feature = "objc2-cloud-kit"))]
73        #[unsafe(method(recordsForManagedObjectIDs:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn recordsForManagedObjectIDs(
76            &self,
77            managed_object_i_ds: &NSArray<NSManagedObjectID>,
78        ) -> Retained<NSDictionary<NSManagedObjectID, CKRecord>>;
79
80        #[cfg(all(feature = "NSManagedObjectID", feature = "objc2-cloud-kit"))]
81        #[unsafe(method(recordIDForManagedObjectID:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn recordIDForManagedObjectID(
84            &self,
85            managed_object_id: &NSManagedObjectID,
86        ) -> Option<Retained<CKRecordID>>;
87
88        #[cfg(all(feature = "NSManagedObjectID", feature = "objc2-cloud-kit"))]
89        #[unsafe(method(recordIDsForManagedObjectIDs:))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn recordIDsForManagedObjectIDs(
92            &self,
93            managed_object_i_ds: &NSArray<NSManagedObjectID>,
94        ) -> Retained<NSDictionary<NSManagedObjectID, CKRecordID>>;
95
96        #[cfg(feature = "NSManagedObjectID")]
97        #[unsafe(method(canUpdateRecordForManagedObjectWithID:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn canUpdateRecordForManagedObjectWithID(
100            &self,
101            object_id: &NSManagedObjectID,
102        ) -> bool;
103
104        #[cfg(feature = "NSManagedObjectID")]
105        #[unsafe(method(canDeleteRecordForManagedObjectWithID:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn canDeleteRecordForManagedObjectWithID(
108            &self,
109            object_id: &NSManagedObjectID,
110        ) -> bool;
111
112        #[cfg(feature = "NSPersistentStore")]
113        #[unsafe(method(canModifyManagedObjectsInStore:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn canModifyManagedObjectsInStore(&self, store: &NSPersistentStore) -> bool;
116    );
117}
118
119/// Methods declared on superclass `NSPersistentContainer`.
120#[cfg(feature = "NSPersistentContainer")]
121impl NSPersistentCloudKitContainer {
122    extern_methods!(
123        #[unsafe(method(persistentContainerWithName:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn persistentContainerWithName(name: &NSString) -> Retained<Self>;
126
127        #[cfg(feature = "NSManagedObjectModel")]
128        #[unsafe(method(persistentContainerWithName:managedObjectModel:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn persistentContainerWithName_managedObjectModel(
131            name: &NSString,
132            model: &NSManagedObjectModel,
133        ) -> Retained<Self>;
134
135        #[unsafe(method(initWithName:))]
136        #[unsafe(method_family = init)]
137        pub unsafe fn initWithName(this: Allocated<Self>, name: &NSString) -> Retained<Self>;
138
139        #[cfg(feature = "NSManagedObjectModel")]
140        #[unsafe(method(initWithName:managedObjectModel:))]
141        #[unsafe(method_family = init)]
142        pub unsafe fn initWithName_managedObjectModel(
143            this: Allocated<Self>,
144            name: &NSString,
145            model: &NSManagedObjectModel,
146        ) -> Retained<Self>;
147    );
148}
149
150/// Methods declared on superclass `NSObject`.
151#[cfg(feature = "NSPersistentContainer")]
152impl NSPersistentCloudKitContainer {
153    extern_methods!(
154        #[unsafe(method(init))]
155        #[unsafe(method_family = init)]
156        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
157
158        #[unsafe(method(new))]
159        #[unsafe(method_family = new)]
160        pub unsafe fn new() -> Retained<Self>;
161    );
162}