objc2_app_kit/generated/
NSDiffableDataSource.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/appkit/nsdiffabledatasourcesnapshot?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct NSDiffableDataSourceSnapshot<
15        SectionIdentifierType: ?Sized = AnyObject,
16        ItemIdentifierType: ?Sized = AnyObject,
17    >;
18);
19
20unsafe impl<SectionIdentifierType: ?Sized, ItemIdentifierType: ?Sized> NSCopying
21    for NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
22{
23}
24
25unsafe impl<SectionIdentifierType: ?Sized + Message, ItemIdentifierType: ?Sized + Message>
26    CopyingHelper for NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
27{
28    type Result = Self;
29}
30
31unsafe impl<SectionIdentifierType: ?Sized, ItemIdentifierType: ?Sized> NSObjectProtocol
32    for NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
33{
34}
35
36impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
37    NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
38{
39    extern_methods!(
40        #[unsafe(method(numberOfItems))]
41        #[unsafe(method_family = none)]
42        pub unsafe fn numberOfItems(&self) -> NSInteger;
43
44        #[unsafe(method(numberOfSections))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn numberOfSections(&self) -> NSInteger;
47
48        #[unsafe(method(sectionIdentifiers))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn sectionIdentifiers(&self) -> Retained<NSArray<SectionIdentifierType>>;
51
52        #[unsafe(method(itemIdentifiers))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn itemIdentifiers(&self) -> Retained<NSArray<ItemIdentifierType>>;
55
56        #[unsafe(method(numberOfItemsInSection:))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn numberOfItemsInSection(
59            &self,
60            section_identifier: &SectionIdentifierType,
61        ) -> NSInteger;
62
63        #[unsafe(method(itemIdentifiersInSectionWithIdentifier:))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn itemIdentifiersInSectionWithIdentifier(
66            &self,
67            section_identifier: &SectionIdentifierType,
68        ) -> Retained<NSArray<ItemIdentifierType>>;
69
70        #[unsafe(method(sectionIdentifierForSectionContainingItemIdentifier:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn sectionIdentifierForSectionContainingItemIdentifier(
73            &self,
74            item_identifier: &ItemIdentifierType,
75        ) -> Option<Retained<SectionIdentifierType>>;
76
77        #[unsafe(method(indexOfItemIdentifier:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn indexOfItemIdentifier(
80            &self,
81            item_identifier: &ItemIdentifierType,
82        ) -> NSInteger;
83
84        #[unsafe(method(indexOfSectionIdentifier:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn indexOfSectionIdentifier(
87            &self,
88            section_identifier: &SectionIdentifierType,
89        ) -> NSInteger;
90
91        #[unsafe(method(appendItemsWithIdentifiers:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn appendItemsWithIdentifiers(&self, identifiers: &NSArray<ItemIdentifierType>);
94
95        #[unsafe(method(appendItemsWithIdentifiers:intoSectionWithIdentifier:))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn appendItemsWithIdentifiers_intoSectionWithIdentifier(
98            &self,
99            identifiers: &NSArray<ItemIdentifierType>,
100            section_identifier: &SectionIdentifierType,
101        );
102
103        #[unsafe(method(insertItemsWithIdentifiers:beforeItemWithIdentifier:))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn insertItemsWithIdentifiers_beforeItemWithIdentifier(
106            &self,
107            identifiers: &NSArray<ItemIdentifierType>,
108            item_identifier: &ItemIdentifierType,
109        );
110
111        #[unsafe(method(insertItemsWithIdentifiers:afterItemWithIdentifier:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn insertItemsWithIdentifiers_afterItemWithIdentifier(
114            &self,
115            identifiers: &NSArray<ItemIdentifierType>,
116            item_identifier: &ItemIdentifierType,
117        );
118
119        #[unsafe(method(deleteItemsWithIdentifiers:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn deleteItemsWithIdentifiers(&self, identifiers: &NSArray<ItemIdentifierType>);
122
123        #[unsafe(method(deleteAllItems))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn deleteAllItems(&self);
126
127        #[unsafe(method(moveItemWithIdentifier:beforeItemWithIdentifier:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn moveItemWithIdentifier_beforeItemWithIdentifier(
130            &self,
131            from_identifier: &ItemIdentifierType,
132            to_identifier: &ItemIdentifierType,
133        );
134
135        #[unsafe(method(moveItemWithIdentifier:afterItemWithIdentifier:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn moveItemWithIdentifier_afterItemWithIdentifier(
138            &self,
139            from_identifier: &ItemIdentifierType,
140            to_identifier: &ItemIdentifierType,
141        );
142
143        #[unsafe(method(reloadItemsWithIdentifiers:))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn reloadItemsWithIdentifiers(&self, identifiers: &NSArray<ItemIdentifierType>);
146
147        #[unsafe(method(appendSectionsWithIdentifiers:))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn appendSectionsWithIdentifiers(
150            &self,
151            section_identifiers: &NSArray<SectionIdentifierType>,
152        );
153
154        #[unsafe(method(insertSectionsWithIdentifiers:beforeSectionWithIdentifier:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn insertSectionsWithIdentifiers_beforeSectionWithIdentifier(
157            &self,
158            section_identifiers: &NSArray<SectionIdentifierType>,
159            to_section_identifier: &SectionIdentifierType,
160        );
161
162        #[unsafe(method(insertSectionsWithIdentifiers:afterSectionWithIdentifier:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn insertSectionsWithIdentifiers_afterSectionWithIdentifier(
165            &self,
166            section_identifiers: &NSArray<SectionIdentifierType>,
167            to_section_identifier: &SectionIdentifierType,
168        );
169
170        #[unsafe(method(deleteSectionsWithIdentifiers:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn deleteSectionsWithIdentifiers(
173            &self,
174            section_identifiers: &NSArray<SectionIdentifierType>,
175        );
176
177        #[unsafe(method(moveSectionWithIdentifier:beforeSectionWithIdentifier:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn moveSectionWithIdentifier_beforeSectionWithIdentifier(
180            &self,
181            from_section_identifier: &SectionIdentifierType,
182            to_section_identifier: &SectionIdentifierType,
183        );
184
185        #[unsafe(method(moveSectionWithIdentifier:afterSectionWithIdentifier:))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn moveSectionWithIdentifier_afterSectionWithIdentifier(
188            &self,
189            from_section_identifier: &SectionIdentifierType,
190            to_section_identifier: &SectionIdentifierType,
191        );
192
193        #[unsafe(method(reloadSectionsWithIdentifiers:))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn reloadSectionsWithIdentifiers(
196            &self,
197            section_identifiers: &NSArray<SectionIdentifierType>,
198        );
199    );
200}
201
202/// Methods declared on superclass `NSObject`.
203impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
204    NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
205{
206    extern_methods!(
207        #[unsafe(method(init))]
208        #[unsafe(method_family = init)]
209        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
210
211        #[unsafe(method(new))]
212        #[unsafe(method_family = new)]
213        pub unsafe fn new() -> Retained<Self>;
214    );
215}
216
217/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionviewdiffabledatasourcesupplementaryviewprovider?language=objc)
218#[cfg(all(
219    feature = "NSCollectionView",
220    feature = "NSResponder",
221    feature = "NSView",
222    feature = "block2"
223))]
224pub type NSCollectionViewDiffableDataSourceSupplementaryViewProvider = *mut block2::Block<
225    dyn Fn(NonNull<NSCollectionView>, NonNull<NSString>, NonNull<NSIndexPath>) -> *mut NSView,
226>;
227
228extern_class!(
229    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscollectionviewdiffabledatasource?language=objc)
230    #[unsafe(super(NSObject))]
231    #[derive(Debug, PartialEq, Eq, Hash)]
232    pub struct NSCollectionViewDiffableDataSource<
233        SectionIdentifierType: ?Sized = AnyObject,
234        ItemIdentifierType: ?Sized = AnyObject,
235    >;
236);
237
238unsafe impl<SectionIdentifierType: ?Sized, ItemIdentifierType: ?Sized> NSObjectProtocol
239    for NSCollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>
240{
241}
242
243impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
244    NSCollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>
245{
246    extern_methods!(
247        #[unsafe(method(init))]
248        #[unsafe(method_family = init)]
249        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
250
251        #[unsafe(method(new))]
252        #[unsafe(method_family = new)]
253        pub unsafe fn new() -> Retained<Self>;
254
255        #[unsafe(method(snapshot))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn snapshot(
258            &self,
259        ) -> Retained<NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>>;
260
261        #[unsafe(method(applySnapshot:animatingDifferences:))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn applySnapshot_animatingDifferences(
264            &self,
265            snapshot: &NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>,
266            animating_differences: bool,
267        );
268
269        #[unsafe(method(itemIdentifierForIndexPath:))]
270        #[unsafe(method_family = none)]
271        pub unsafe fn itemIdentifierForIndexPath(
272            &self,
273            index_path: &NSIndexPath,
274        ) -> Option<Retained<ItemIdentifierType>>;
275
276        #[unsafe(method(indexPathForItemIdentifier:))]
277        #[unsafe(method_family = none)]
278        pub unsafe fn indexPathForItemIdentifier(
279            &self,
280            identifier: &ItemIdentifierType,
281        ) -> Option<Retained<NSIndexPath>>;
282
283        #[cfg(all(
284            feature = "NSCollectionView",
285            feature = "NSResponder",
286            feature = "NSView",
287            feature = "block2"
288        ))]
289        #[unsafe(method(supplementaryViewProvider))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn supplementaryViewProvider(
292            &self,
293            mtm: MainThreadMarker,
294        ) -> NSCollectionViewDiffableDataSourceSupplementaryViewProvider;
295
296        #[cfg(all(
297            feature = "NSCollectionView",
298            feature = "NSResponder",
299            feature = "NSView",
300            feature = "block2"
301        ))]
302        /// Setter for [`supplementaryViewProvider`][Self::supplementaryViewProvider].
303        #[unsafe(method(setSupplementaryViewProvider:))]
304        #[unsafe(method_family = none)]
305        pub unsafe fn setSupplementaryViewProvider(
306            &self,
307            supplementary_view_provider: NSCollectionViewDiffableDataSourceSupplementaryViewProvider,
308        );
309    );
310}