objc2_core_data/generated/
NSPersistentContainer.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 #[unsafe(super(NSObject))]
13 #[derive(Debug, PartialEq, Eq, Hash)]
14 pub struct NSPersistentContainer;
15);
16
17unsafe impl Send for NSPersistentContainer {}
18
19unsafe impl Sync for NSPersistentContainer {}
20
21extern_conformance!(
22 unsafe impl NSObjectProtocol for NSPersistentContainer {}
23);
24
25impl NSPersistentContainer {
26 extern_methods!(
27 #[unsafe(method(persistentContainerWithName:))]
28 #[unsafe(method_family = none)]
29 pub unsafe fn persistentContainerWithName(name: &NSString) -> Retained<Self>;
30
31 #[cfg(feature = "NSManagedObjectModel")]
32 #[unsafe(method(persistentContainerWithName:managedObjectModel:))]
33 #[unsafe(method_family = none)]
34 pub unsafe fn persistentContainerWithName_managedObjectModel(
35 name: &NSString,
36 model: &NSManagedObjectModel,
37 ) -> Retained<Self>;
38
39 #[unsafe(method(defaultDirectoryURL))]
40 #[unsafe(method_family = none)]
41 pub unsafe fn defaultDirectoryURL() -> Retained<NSURL>;
42
43 #[unsafe(method(name))]
44 #[unsafe(method_family = none)]
45 pub unsafe fn name(&self) -> Retained<NSString>;
46
47 #[cfg(feature = "NSManagedObjectContext")]
48 #[unsafe(method(viewContext))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn viewContext(&self) -> Retained<NSManagedObjectContext>;
51
52 #[cfg(feature = "NSManagedObjectModel")]
53 #[unsafe(method(managedObjectModel))]
54 #[unsafe(method_family = none)]
55 pub unsafe fn managedObjectModel(&self) -> Retained<NSManagedObjectModel>;
56
57 #[cfg(feature = "NSPersistentStoreCoordinator")]
58 #[unsafe(method(persistentStoreCoordinator))]
59 #[unsafe(method_family = none)]
60 pub unsafe fn persistentStoreCoordinator(&self) -> Retained<NSPersistentStoreCoordinator>;
61
62 #[cfg(feature = "NSPersistentStoreDescription")]
63 #[unsafe(method(persistentStoreDescriptions))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn persistentStoreDescriptions(
66 &self,
67 ) -> Retained<NSArray<NSPersistentStoreDescription>>;
68
69 #[cfg(feature = "NSPersistentStoreDescription")]
70 #[unsafe(method(setPersistentStoreDescriptions:))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn setPersistentStoreDescriptions(
76 &self,
77 persistent_store_descriptions: &NSArray<NSPersistentStoreDescription>,
78 );
79
80 #[unsafe(method(initWithName:))]
81 #[unsafe(method_family = init)]
82 pub unsafe fn initWithName(this: Allocated<Self>, name: &NSString) -> Retained<Self>;
83
84 #[cfg(feature = "NSManagedObjectModel")]
85 #[unsafe(method(initWithName:managedObjectModel:))]
86 #[unsafe(method_family = init)]
87 pub unsafe fn initWithName_managedObjectModel(
88 this: Allocated<Self>,
89 name: &NSString,
90 model: &NSManagedObjectModel,
91 ) -> Retained<Self>;
92
93 #[cfg(all(feature = "NSPersistentStoreDescription", feature = "block2"))]
94 #[unsafe(method(loadPersistentStoresWithCompletionHandler:))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn loadPersistentStoresWithCompletionHandler(
97 &self,
98 block: &block2::DynBlock<dyn Fn(NonNull<NSPersistentStoreDescription>, *mut NSError)>,
99 );
100
101 #[cfg(feature = "NSManagedObjectContext")]
102 #[unsafe(method(newBackgroundContext))]
103 #[unsafe(method_family = new)]
104 pub unsafe fn newBackgroundContext(&self) -> Retained<NSManagedObjectContext>;
105
106 #[cfg(all(feature = "NSManagedObjectContext", feature = "block2"))]
107 #[unsafe(method(performBackgroundTask:))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn performBackgroundTask(
113 &self,
114 block: &block2::DynBlock<dyn Fn(NonNull<NSManagedObjectContext>)>,
115 );
116 );
117}
118
119impl NSPersistentContainer {
121 extern_methods!(
122 #[unsafe(method(init))]
123 #[unsafe(method_family = init)]
124 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
125
126 #[unsafe(method(new))]
127 #[unsafe(method_family = new)]
128 pub unsafe fn new() -> Retained<Self>;
129 );
130}