objc2_core_data/generated/
NSPersistentStore.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/coredata/nspersistentstore?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct NSPersistentStore;
15);
16
17extern_conformance!(
18    unsafe impl NSObjectProtocol for NSPersistentStore {}
19);
20
21impl NSPersistentStore {
22    extern_methods!(
23        #[unsafe(method(metadataForPersistentStoreWithURL:error:_))]
24        #[unsafe(method_family = none)]
25        pub unsafe fn metadataForPersistentStoreWithURL_error(
26            url: &NSURL,
27        ) -> Result<Retained<NSDictionary<NSString, AnyObject>>, Retained<NSError>>;
28
29        /// # Safety
30        ///
31        /// `metadata` generic should be of the correct type.
32        #[unsafe(method(setMetadata:forPersistentStoreWithURL:error:_))]
33        #[unsafe(method_family = none)]
34        pub unsafe fn setMetadata_forPersistentStoreWithURL_error(
35            metadata: Option<&NSDictionary<NSString, AnyObject>>,
36            url: &NSURL,
37        ) -> Result<(), Retained<NSError>>;
38
39        #[unsafe(method(migrationManagerClass))]
40        #[unsafe(method_family = none)]
41        pub unsafe fn migrationManagerClass() -> &'static AnyClass;
42
43        #[cfg(feature = "NSPersistentStoreCoordinator")]
44        /// # Safety
45        ///
46        /// `options` generic should be of the correct type.
47        #[unsafe(method(initWithPersistentStoreCoordinator:configurationName:URL:options:))]
48        #[unsafe(method_family = init)]
49        pub unsafe fn initWithPersistentStoreCoordinator_configurationName_URL_options(
50            this: Allocated<Self>,
51            root: Option<&NSPersistentStoreCoordinator>,
52            name: Option<&NSString>,
53            url: &NSURL,
54            options: Option<&NSDictionary>,
55        ) -> Retained<Self>;
56
57        #[unsafe(method(init))]
58        #[unsafe(method_family = init)]
59        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
60
61        #[unsafe(method(loadMetadata:_))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn loadMetadata(&self) -> Result<(), Retained<NSError>>;
64
65        #[cfg(feature = "NSPersistentStoreCoordinator")]
66        #[unsafe(method(persistentStoreCoordinator))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn persistentStoreCoordinator(
69            &self,
70        ) -> Option<Retained<NSPersistentStoreCoordinator>>;
71
72        #[unsafe(method(configurationName))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn configurationName(&self) -> Retained<NSString>;
75
76        #[unsafe(method(options))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn options(&self) -> Option<Retained<NSDictionary>>;
79
80        #[unsafe(method(URL))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
83
84        /// Setter for [`URL`][Self::URL].
85        #[unsafe(method(setURL:))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn setURL(&self, url: Option<&NSURL>);
88
89        #[unsafe(method(identifier))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn identifier(&self) -> Retained<NSString>;
92
93        /// Setter for [`identifier`][Self::identifier].
94        ///
95        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
96        #[unsafe(method(setIdentifier:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn setIdentifier(&self, identifier: Option<&NSString>);
99
100        #[unsafe(method(type))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn r#type(&self) -> Retained<NSString>;
103
104        #[unsafe(method(isReadOnly))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn isReadOnly(&self) -> bool;
107
108        /// Setter for [`isReadOnly`][Self::isReadOnly].
109        #[unsafe(method(setReadOnly:))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn setReadOnly(&self, read_only: bool);
112
113        #[unsafe(method(metadata))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn metadata(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
116
117        /// Setter for [`metadata`][Self::metadata].
118        ///
119        /// # Safety
120        ///
121        /// - `metadata` generic should be of the correct type.
122        /// - `metadata` might not allow `None`.
123        #[unsafe(method(setMetadata:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setMetadata(&self, metadata: Option<&NSDictionary<NSString, AnyObject>>);
126
127        #[cfg(feature = "NSPersistentStoreCoordinator")]
128        #[unsafe(method(didAddToPersistentStoreCoordinator:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn didAddToPersistentStoreCoordinator(
131            &self,
132            coordinator: &NSPersistentStoreCoordinator,
133        );
134
135        #[cfg(feature = "NSPersistentStoreCoordinator")]
136        #[unsafe(method(willRemoveFromPersistentStoreCoordinator:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn willRemoveFromPersistentStoreCoordinator(
139            &self,
140            coordinator: Option<&NSPersistentStoreCoordinator>,
141        );
142
143        #[cfg(feature = "NSCoreDataCoreSpotlightDelegate")]
144        #[unsafe(method(coreSpotlightExporter))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn coreSpotlightExporter(&self) -> Retained<NSCoreDataCoreSpotlightDelegate>;
147    );
148}
149
150/// Methods declared on superclass `NSObject`.
151impl NSPersistentStore {
152    extern_methods!(
153        #[unsafe(method(new))]
154        #[unsafe(method_family = new)]
155        pub unsafe fn new() -> Retained<Self>;
156    );
157}