1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10 #[unsafe(super(NSObject))]
14 #[derive(Debug, PartialEq, Eq, Hash)]
15 pub struct NSOrderedSet<ObjectType: ?Sized = AnyObject>;
16);
17
18#[cfg(feature = "NSObject")]
19unsafe impl<ObjectType: ?Sized + NSCoding> NSCoding for NSOrderedSet<ObjectType> {}
20
21#[cfg(feature = "NSObject")]
22unsafe impl<ObjectType: ?Sized> NSCopying for NSOrderedSet<ObjectType> {}
23
24#[cfg(feature = "NSObject")]
25unsafe impl<ObjectType: ?Sized + Message> CopyingHelper for NSOrderedSet<ObjectType> {
26 type Result = Self;
27}
28
29#[cfg(feature = "NSEnumerator")]
30unsafe impl<ObjectType: ?Sized> NSFastEnumeration for NSOrderedSet<ObjectType> {}
31
32#[cfg(feature = "NSObject")]
33unsafe impl<ObjectType: ?Sized> NSMutableCopying for NSOrderedSet<ObjectType> {}
34
35#[cfg(feature = "NSObject")]
36unsafe impl<ObjectType: ?Sized + Message> MutableCopyingHelper for NSOrderedSet<ObjectType> {
37 type Result = NSMutableOrderedSet<ObjectType>;
38}
39
40unsafe impl<ObjectType: ?Sized> NSObjectProtocol for NSOrderedSet<ObjectType> {}
41
42#[cfg(feature = "NSObject")]
43unsafe impl<ObjectType: ?Sized + NSSecureCoding> NSSecureCoding for NSOrderedSet<ObjectType> {}
44
45impl<ObjectType: Message> NSOrderedSet<ObjectType> {
46 extern_methods!(
47 #[unsafe(method(count))]
48 #[unsafe(method_family = none)]
49 pub unsafe fn count(&self) -> NSUInteger;
50
51 #[unsafe(method(objectAtIndex:))]
52 #[unsafe(method_family = none)]
53 pub unsafe fn objectAtIndex(&self, idx: NSUInteger) -> Retained<ObjectType>;
54
55 #[unsafe(method(indexOfObject:))]
56 #[unsafe(method_family = none)]
57 pub unsafe fn indexOfObject(&self, object: &ObjectType) -> NSUInteger;
58
59 #[unsafe(method(init))]
60 #[unsafe(method_family = init)]
61 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
62
63 #[unsafe(method(initWithObjects:count:))]
64 #[unsafe(method_family = init)]
65 pub unsafe fn initWithObjects_count(
66 this: Allocated<Self>,
67 objects: *mut NonNull<ObjectType>,
68 cnt: NSUInteger,
69 ) -> Retained<Self>;
70
71 #[cfg(feature = "NSCoder")]
72 #[unsafe(method(initWithCoder:))]
73 #[unsafe(method_family = init)]
74 pub unsafe fn initWithCoder(
75 this: Allocated<Self>,
76 coder: &NSCoder,
77 ) -> Option<Retained<Self>>;
78 );
79}
80
81impl<ObjectType: Message> NSOrderedSet<ObjectType> {
83 extern_methods!(
84 #[unsafe(method(new))]
85 #[unsafe(method_family = new)]
86 pub unsafe fn new() -> Retained<Self>;
87 );
88}
89
90impl<ObjectType: Message> NSOrderedSet<ObjectType> {
92 extern_methods!(
93 #[cfg(feature = "NSRange")]
94 #[unsafe(method(getObjects:range:))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn getObjects_range(&self, objects: *mut NonNull<ObjectType>, range: NSRange);
97
98 #[cfg(all(feature = "NSArray", feature = "NSIndexSet"))]
99 #[unsafe(method(objectsAtIndexes:))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn objectsAtIndexes(
102 &self,
103 indexes: &NSIndexSet,
104 ) -> Retained<NSArray<ObjectType>>;
105
106 #[unsafe(method(firstObject))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn firstObject(&self) -> Option<Retained<ObjectType>>;
109
110 #[unsafe(method(lastObject))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn lastObject(&self) -> Option<Retained<ObjectType>>;
113
114 #[unsafe(method(isEqualToOrderedSet:))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn isEqualToOrderedSet(&self, other: &NSOrderedSet<ObjectType>) -> bool;
117
118 #[unsafe(method(containsObject:))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn containsObject(&self, object: &ObjectType) -> bool;
121
122 #[unsafe(method(intersectsOrderedSet:))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn intersectsOrderedSet(&self, other: &NSOrderedSet<ObjectType>) -> bool;
125
126 #[cfg(feature = "NSSet")]
127 #[unsafe(method(intersectsSet:))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn intersectsSet(&self, set: &NSSet<ObjectType>) -> bool;
130
131 #[unsafe(method(isSubsetOfOrderedSet:))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn isSubsetOfOrderedSet(&self, other: &NSOrderedSet<ObjectType>) -> bool;
134
135 #[cfg(feature = "NSSet")]
136 #[unsafe(method(isSubsetOfSet:))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn isSubsetOfSet(&self, set: &NSSet<ObjectType>) -> bool;
139
140 #[unsafe(method(objectAtIndexedSubscript:))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn objectAtIndexedSubscript(&self, idx: NSUInteger) -> Retained<ObjectType>;
143
144 #[cfg(feature = "NSEnumerator")]
145 #[unsafe(method(objectEnumerator))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn objectEnumerator(&self) -> Retained<NSEnumerator<ObjectType>>;
148
149 #[cfg(feature = "NSEnumerator")]
150 #[unsafe(method(reverseObjectEnumerator))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn reverseObjectEnumerator(&self) -> Retained<NSEnumerator<ObjectType>>;
153
154 #[unsafe(method(reversedOrderedSet))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn reversedOrderedSet(&self) -> Retained<NSOrderedSet<ObjectType>>;
157
158 #[cfg(feature = "NSArray")]
159 #[unsafe(method(array))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn array(&self) -> Retained<NSArray<ObjectType>>;
162
163 #[cfg(feature = "NSSet")]
164 #[unsafe(method(set))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn set(&self) -> Retained<NSSet<ObjectType>>;
167
168 #[cfg(feature = "block2")]
169 #[unsafe(method(enumerateObjectsUsingBlock:))]
170 #[unsafe(method_family = none)]
171 pub unsafe fn enumerateObjectsUsingBlock(
172 &self,
173 block: &block2::Block<dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) + '_>,
174 );
175
176 #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
177 #[unsafe(method(enumerateObjectsWithOptions:usingBlock:))]
178 #[unsafe(method_family = none)]
179 pub unsafe fn enumerateObjectsWithOptions_usingBlock(
180 &self,
181 opts: NSEnumerationOptions,
182 block: &block2::Block<dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) + '_>,
183 );
184
185 #[cfg(all(feature = "NSIndexSet", feature = "NSObjCRuntime", feature = "block2"))]
186 #[unsafe(method(enumerateObjectsAtIndexes:options:usingBlock:))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn enumerateObjectsAtIndexes_options_usingBlock(
189 &self,
190 s: &NSIndexSet,
191 opts: NSEnumerationOptions,
192 block: &block2::Block<dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) + '_>,
193 );
194
195 #[cfg(feature = "block2")]
196 #[unsafe(method(indexOfObjectPassingTest:))]
197 #[unsafe(method_family = none)]
198 pub unsafe fn indexOfObjectPassingTest(
199 &self,
200 predicate: &block2::Block<
201 dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) -> Bool + '_,
202 >,
203 ) -> NSUInteger;
204
205 #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
206 #[unsafe(method(indexOfObjectWithOptions:passingTest:))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn indexOfObjectWithOptions_passingTest(
209 &self,
210 opts: NSEnumerationOptions,
211 predicate: &block2::Block<
212 dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) -> Bool + '_,
213 >,
214 ) -> NSUInteger;
215
216 #[cfg(all(feature = "NSIndexSet", feature = "NSObjCRuntime", feature = "block2"))]
217 #[unsafe(method(indexOfObjectAtIndexes:options:passingTest:))]
218 #[unsafe(method_family = none)]
219 pub unsafe fn indexOfObjectAtIndexes_options_passingTest(
220 &self,
221 s: &NSIndexSet,
222 opts: NSEnumerationOptions,
223 predicate: &block2::Block<
224 dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) -> Bool + '_,
225 >,
226 ) -> NSUInteger;
227
228 #[cfg(all(feature = "NSIndexSet", feature = "block2"))]
229 #[unsafe(method(indexesOfObjectsPassingTest:))]
230 #[unsafe(method_family = none)]
231 pub unsafe fn indexesOfObjectsPassingTest(
232 &self,
233 predicate: &block2::Block<
234 dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) -> Bool + '_,
235 >,
236 ) -> Retained<NSIndexSet>;
237
238 #[cfg(all(feature = "NSIndexSet", feature = "NSObjCRuntime", feature = "block2"))]
239 #[unsafe(method(indexesOfObjectsWithOptions:passingTest:))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn indexesOfObjectsWithOptions_passingTest(
242 &self,
243 opts: NSEnumerationOptions,
244 predicate: &block2::Block<
245 dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) -> Bool + '_,
246 >,
247 ) -> Retained<NSIndexSet>;
248
249 #[cfg(all(feature = "NSIndexSet", feature = "NSObjCRuntime", feature = "block2"))]
250 #[unsafe(method(indexesOfObjectsAtIndexes:options:passingTest:))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn indexesOfObjectsAtIndexes_options_passingTest(
253 &self,
254 s: &NSIndexSet,
255 opts: NSEnumerationOptions,
256 predicate: &block2::Block<
257 dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) -> Bool + '_,
258 >,
259 ) -> Retained<NSIndexSet>;
260
261 #[cfg(all(
262 feature = "NSArray",
263 feature = "NSObjCRuntime",
264 feature = "NSRange",
265 feature = "block2"
266 ))]
267 #[unsafe(method(indexOfObject:inSortedRange:options:usingComparator:))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn indexOfObject_inSortedRange_options_usingComparator(
270 &self,
271 object: &ObjectType,
272 range: NSRange,
273 opts: NSBinarySearchingOptions,
274 cmp: NSComparator,
275 ) -> NSUInteger;
276
277 #[cfg(all(feature = "NSArray", feature = "NSObjCRuntime", feature = "block2"))]
278 #[unsafe(method(sortedArrayUsingComparator:))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn sortedArrayUsingComparator(
281 &self,
282 cmptr: NSComparator,
283 ) -> Retained<NSArray<ObjectType>>;
284
285 #[cfg(all(feature = "NSArray", feature = "NSObjCRuntime", feature = "block2"))]
286 #[unsafe(method(sortedArrayWithOptions:usingComparator:))]
287 #[unsafe(method_family = none)]
288 pub unsafe fn sortedArrayWithOptions_usingComparator(
289 &self,
290 opts: NSSortOptions,
291 cmptr: NSComparator,
292 ) -> Retained<NSArray<ObjectType>>;
293
294 #[cfg(feature = "NSString")]
295 #[unsafe(method(description))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn description(&self) -> Retained<NSString>;
298
299 #[cfg(feature = "NSString")]
300 #[unsafe(method(descriptionWithLocale:))]
301 #[unsafe(method_family = none)]
302 pub unsafe fn descriptionWithLocale(
303 &self,
304 locale: Option<&AnyObject>,
305 ) -> Retained<NSString>;
306
307 #[cfg(feature = "NSString")]
308 #[unsafe(method(descriptionWithLocale:indent:))]
309 #[unsafe(method_family = none)]
310 pub unsafe fn descriptionWithLocale_indent(
311 &self,
312 locale: Option<&AnyObject>,
313 level: NSUInteger,
314 ) -> Retained<NSString>;
315 );
316}
317
318impl<ObjectType: Message> NSOrderedSet<ObjectType> {
320 extern_methods!(
321 #[unsafe(method(orderedSet))]
322 #[unsafe(method_family = none)]
323 pub unsafe fn orderedSet() -> Retained<Self>;
324
325 #[unsafe(method(orderedSetWithObject:))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn orderedSetWithObject(object: &ObjectType) -> Retained<Self>;
328
329 #[unsafe(method(orderedSetWithObjects:count:))]
330 #[unsafe(method_family = none)]
331 pub unsafe fn orderedSetWithObjects_count(
332 objects: NonNull<NonNull<ObjectType>>,
333 cnt: NSUInteger,
334 ) -> Retained<Self>;
335
336 #[unsafe(method(orderedSetWithOrderedSet:))]
337 #[unsafe(method_family = none)]
338 pub unsafe fn orderedSetWithOrderedSet(set: &NSOrderedSet<ObjectType>) -> Retained<Self>;
339
340 #[cfg(feature = "NSRange")]
341 #[unsafe(method(orderedSetWithOrderedSet:range:copyItems:))]
342 #[unsafe(method_family = none)]
343 pub unsafe fn orderedSetWithOrderedSet_range_copyItems(
344 set: &NSOrderedSet<ObjectType>,
345 range: NSRange,
346 flag: bool,
347 ) -> Retained<Self>;
348
349 #[cfg(feature = "NSArray")]
350 #[unsafe(method(orderedSetWithArray:))]
351 #[unsafe(method_family = none)]
352 pub unsafe fn orderedSetWithArray(array: &NSArray<ObjectType>) -> Retained<Self>;
353
354 #[cfg(all(feature = "NSArray", feature = "NSRange"))]
355 #[unsafe(method(orderedSetWithArray:range:copyItems:))]
356 #[unsafe(method_family = none)]
357 pub unsafe fn orderedSetWithArray_range_copyItems(
358 array: &NSArray<ObjectType>,
359 range: NSRange,
360 flag: bool,
361 ) -> Retained<Self>;
362
363 #[cfg(feature = "NSSet")]
364 #[unsafe(method(orderedSetWithSet:))]
365 #[unsafe(method_family = none)]
366 pub unsafe fn orderedSetWithSet(set: &NSSet<ObjectType>) -> Retained<Self>;
367
368 #[cfg(feature = "NSSet")]
369 #[unsafe(method(orderedSetWithSet:copyItems:))]
370 #[unsafe(method_family = none)]
371 pub unsafe fn orderedSetWithSet_copyItems(
372 set: &NSSet<ObjectType>,
373 flag: bool,
374 ) -> Retained<Self>;
375
376 #[unsafe(method(initWithObject:))]
377 #[unsafe(method_family = init)]
378 pub unsafe fn initWithObject(this: Allocated<Self>, object: &ObjectType) -> Retained<Self>;
379
380 #[unsafe(method(initWithOrderedSet:))]
381 #[unsafe(method_family = init)]
382 pub unsafe fn initWithOrderedSet(
383 this: Allocated<Self>,
384 set: &NSOrderedSet<ObjectType>,
385 ) -> Retained<Self>;
386
387 #[unsafe(method(initWithOrderedSet:copyItems:))]
388 #[unsafe(method_family = init)]
389 pub unsafe fn initWithOrderedSet_copyItems(
390 this: Allocated<Self>,
391 set: &NSOrderedSet<ObjectType>,
392 flag: bool,
393 ) -> Retained<Self>;
394
395 #[cfg(feature = "NSRange")]
396 #[unsafe(method(initWithOrderedSet:range:copyItems:))]
397 #[unsafe(method_family = init)]
398 pub unsafe fn initWithOrderedSet_range_copyItems(
399 this: Allocated<Self>,
400 set: &NSOrderedSet<ObjectType>,
401 range: NSRange,
402 flag: bool,
403 ) -> Retained<Self>;
404
405 #[cfg(feature = "NSArray")]
406 #[unsafe(method(initWithArray:))]
407 #[unsafe(method_family = init)]
408 pub unsafe fn initWithArray(
409 this: Allocated<Self>,
410 array: &NSArray<ObjectType>,
411 ) -> Retained<Self>;
412
413 #[cfg(feature = "NSArray")]
414 #[unsafe(method(initWithArray:copyItems:))]
415 #[unsafe(method_family = init)]
416 pub unsafe fn initWithArray_copyItems(
417 this: Allocated<Self>,
418 set: &NSArray<ObjectType>,
419 flag: bool,
420 ) -> Retained<Self>;
421
422 #[cfg(all(feature = "NSArray", feature = "NSRange"))]
423 #[unsafe(method(initWithArray:range:copyItems:))]
424 #[unsafe(method_family = init)]
425 pub unsafe fn initWithArray_range_copyItems(
426 this: Allocated<Self>,
427 set: &NSArray<ObjectType>,
428 range: NSRange,
429 flag: bool,
430 ) -> Retained<Self>;
431
432 #[cfg(feature = "NSSet")]
433 #[unsafe(method(initWithSet:))]
434 #[unsafe(method_family = init)]
435 pub unsafe fn initWithSet(this: Allocated<Self>, set: &NSSet<ObjectType>)
436 -> Retained<Self>;
437
438 #[cfg(feature = "NSSet")]
439 #[unsafe(method(initWithSet:copyItems:))]
440 #[unsafe(method_family = init)]
441 pub unsafe fn initWithSet_copyItems(
442 this: Allocated<Self>,
443 set: &NSSet<ObjectType>,
444 flag: bool,
445 ) -> Retained<Self>;
446 );
447}
448
449impl<ObjectType: Message> NSMutableOrderedSet<ObjectType> {
453 extern_methods!(
454 #[unsafe(method(orderedSet))]
455 #[unsafe(method_family = none)]
456 pub unsafe fn orderedSet() -> Retained<Self>;
457
458 #[unsafe(method(orderedSetWithObject:))]
459 #[unsafe(method_family = none)]
460 pub unsafe fn orderedSetWithObject(object: &ObjectType) -> Retained<Self>;
461
462 #[unsafe(method(orderedSetWithObjects:count:))]
463 #[unsafe(method_family = none)]
464 pub unsafe fn orderedSetWithObjects_count(
465 objects: NonNull<NonNull<ObjectType>>,
466 cnt: NSUInteger,
467 ) -> Retained<Self>;
468
469 #[unsafe(method(orderedSetWithOrderedSet:))]
470 #[unsafe(method_family = none)]
471 pub unsafe fn orderedSetWithOrderedSet(set: &NSOrderedSet<ObjectType>) -> Retained<Self>;
472
473 #[cfg(feature = "NSRange")]
474 #[unsafe(method(orderedSetWithOrderedSet:range:copyItems:))]
475 #[unsafe(method_family = none)]
476 pub unsafe fn orderedSetWithOrderedSet_range_copyItems(
477 set: &NSOrderedSet<ObjectType>,
478 range: NSRange,
479 flag: bool,
480 ) -> Retained<Self>;
481
482 #[cfg(feature = "NSArray")]
483 #[unsafe(method(orderedSetWithArray:))]
484 #[unsafe(method_family = none)]
485 pub unsafe fn orderedSetWithArray(array: &NSArray<ObjectType>) -> Retained<Self>;
486
487 #[cfg(all(feature = "NSArray", feature = "NSRange"))]
488 #[unsafe(method(orderedSetWithArray:range:copyItems:))]
489 #[unsafe(method_family = none)]
490 pub unsafe fn orderedSetWithArray_range_copyItems(
491 array: &NSArray<ObjectType>,
492 range: NSRange,
493 flag: bool,
494 ) -> Retained<Self>;
495
496 #[cfg(feature = "NSSet")]
497 #[unsafe(method(orderedSetWithSet:))]
498 #[unsafe(method_family = none)]
499 pub unsafe fn orderedSetWithSet(set: &NSSet<ObjectType>) -> Retained<Self>;
500
501 #[cfg(feature = "NSSet")]
502 #[unsafe(method(orderedSetWithSet:copyItems:))]
503 #[unsafe(method_family = none)]
504 pub unsafe fn orderedSetWithSet_copyItems(
505 set: &NSSet<ObjectType>,
506 flag: bool,
507 ) -> Retained<Self>;
508
509 #[unsafe(method(initWithObject:))]
510 #[unsafe(method_family = init)]
511 pub unsafe fn initWithObject(this: Allocated<Self>, object: &ObjectType) -> Retained<Self>;
512
513 #[unsafe(method(initWithOrderedSet:))]
514 #[unsafe(method_family = init)]
515 pub unsafe fn initWithOrderedSet(
516 this: Allocated<Self>,
517 set: &NSOrderedSet<ObjectType>,
518 ) -> Retained<Self>;
519
520 #[unsafe(method(initWithOrderedSet:copyItems:))]
521 #[unsafe(method_family = init)]
522 pub unsafe fn initWithOrderedSet_copyItems(
523 this: Allocated<Self>,
524 set: &NSOrderedSet<ObjectType>,
525 flag: bool,
526 ) -> Retained<Self>;
527
528 #[cfg(feature = "NSRange")]
529 #[unsafe(method(initWithOrderedSet:range:copyItems:))]
530 #[unsafe(method_family = init)]
531 pub unsafe fn initWithOrderedSet_range_copyItems(
532 this: Allocated<Self>,
533 set: &NSOrderedSet<ObjectType>,
534 range: NSRange,
535 flag: bool,
536 ) -> Retained<Self>;
537
538 #[cfg(feature = "NSArray")]
539 #[unsafe(method(initWithArray:))]
540 #[unsafe(method_family = init)]
541 pub unsafe fn initWithArray(
542 this: Allocated<Self>,
543 array: &NSArray<ObjectType>,
544 ) -> Retained<Self>;
545
546 #[cfg(feature = "NSArray")]
547 #[unsafe(method(initWithArray:copyItems:))]
548 #[unsafe(method_family = init)]
549 pub unsafe fn initWithArray_copyItems(
550 this: Allocated<Self>,
551 set: &NSArray<ObjectType>,
552 flag: bool,
553 ) -> Retained<Self>;
554
555 #[cfg(all(feature = "NSArray", feature = "NSRange"))]
556 #[unsafe(method(initWithArray:range:copyItems:))]
557 #[unsafe(method_family = init)]
558 pub unsafe fn initWithArray_range_copyItems(
559 this: Allocated<Self>,
560 set: &NSArray<ObjectType>,
561 range: NSRange,
562 flag: bool,
563 ) -> Retained<Self>;
564
565 #[cfg(feature = "NSSet")]
566 #[unsafe(method(initWithSet:))]
567 #[unsafe(method_family = init)]
568 pub unsafe fn initWithSet(this: Allocated<Self>, set: &NSSet<ObjectType>)
569 -> Retained<Self>;
570
571 #[cfg(feature = "NSSet")]
572 #[unsafe(method(initWithSet:copyItems:))]
573 #[unsafe(method_family = init)]
574 pub unsafe fn initWithSet_copyItems(
575 this: Allocated<Self>,
576 set: &NSSet<ObjectType>,
577 flag: bool,
578 ) -> Retained<Self>;
579 );
580}
581
582impl<ObjectType: Message> NSOrderedSet<ObjectType> {
584 extern_methods!(
585 #[cfg(all(feature = "NSOrderedCollectionDifference", feature = "block2"))]
586 #[unsafe(method(differenceFromOrderedSet:withOptions:usingEquivalenceTest:))]
587 #[unsafe(method_family = none)]
588 pub unsafe fn differenceFromOrderedSet_withOptions_usingEquivalenceTest(
589 &self,
590 other: &NSOrderedSet<ObjectType>,
591 options: NSOrderedCollectionDifferenceCalculationOptions,
592 block: &block2::Block<dyn Fn(NonNull<ObjectType>, NonNull<ObjectType>) -> Bool + '_>,
593 ) -> Retained<NSOrderedCollectionDifference<ObjectType>>;
594
595 #[cfg(feature = "NSOrderedCollectionDifference")]
596 #[unsafe(method(differenceFromOrderedSet:withOptions:))]
597 #[unsafe(method_family = none)]
598 pub unsafe fn differenceFromOrderedSet_withOptions(
599 &self,
600 other: &NSOrderedSet<ObjectType>,
601 options: NSOrderedCollectionDifferenceCalculationOptions,
602 ) -> Retained<NSOrderedCollectionDifference<ObjectType>>;
603
604 #[cfg(feature = "NSOrderedCollectionDifference")]
605 #[unsafe(method(differenceFromOrderedSet:))]
606 #[unsafe(method_family = none)]
607 pub unsafe fn differenceFromOrderedSet(
608 &self,
609 other: &NSOrderedSet<ObjectType>,
610 ) -> Retained<NSOrderedCollectionDifference<ObjectType>>;
611
612 #[cfg(feature = "NSOrderedCollectionDifference")]
613 #[unsafe(method(orderedSetByApplyingDifference:))]
614 #[unsafe(method_family = none)]
615 pub unsafe fn orderedSetByApplyingDifference(
616 &self,
617 difference: &NSOrderedCollectionDifference<ObjectType>,
618 ) -> Option<Retained<NSOrderedSet<ObjectType>>>;
619 );
620}
621
622extern_class!(
623 #[unsafe(super(NSOrderedSet<ObjectType, >, NSObject))]
627 #[derive(Debug, PartialEq, Eq, Hash)]
628 pub struct NSMutableOrderedSet<ObjectType: ?Sized = AnyObject>;
629);
630
631#[cfg(feature = "NSObject")]
632unsafe impl<ObjectType: ?Sized + NSCoding> NSCoding for NSMutableOrderedSet<ObjectType> {}
633
634#[cfg(feature = "NSObject")]
635unsafe impl<ObjectType: ?Sized> NSCopying for NSMutableOrderedSet<ObjectType> {}
636
637#[cfg(feature = "NSObject")]
638unsafe impl<ObjectType: ?Sized + Message> CopyingHelper for NSMutableOrderedSet<ObjectType> {
639 type Result = NSOrderedSet<ObjectType>;
640}
641
642#[cfg(feature = "NSEnumerator")]
643unsafe impl<ObjectType: ?Sized> NSFastEnumeration for NSMutableOrderedSet<ObjectType> {}
644
645#[cfg(feature = "NSObject")]
646unsafe impl<ObjectType: ?Sized> NSMutableCopying for NSMutableOrderedSet<ObjectType> {}
647
648#[cfg(feature = "NSObject")]
649unsafe impl<ObjectType: ?Sized + Message> MutableCopyingHelper for NSMutableOrderedSet<ObjectType> {
650 type Result = Self;
651}
652
653unsafe impl<ObjectType: ?Sized> NSObjectProtocol for NSMutableOrderedSet<ObjectType> {}
654
655#[cfg(feature = "NSObject")]
656unsafe impl<ObjectType: ?Sized + NSSecureCoding> NSSecureCoding
657 for NSMutableOrderedSet<ObjectType>
658{
659}
660
661impl<ObjectType: Message> NSMutableOrderedSet<ObjectType> {
662 extern_methods!(
663 #[unsafe(method(insertObject:atIndex:))]
664 #[unsafe(method_family = none)]
665 pub unsafe fn insertObject_atIndex(&self, object: &ObjectType, idx: NSUInteger);
666
667 #[unsafe(method(removeObjectAtIndex:))]
668 #[unsafe(method_family = none)]
669 pub unsafe fn removeObjectAtIndex(&self, idx: NSUInteger);
670
671 #[unsafe(method(replaceObjectAtIndex:withObject:))]
672 #[unsafe(method_family = none)]
673 pub unsafe fn replaceObjectAtIndex_withObject(&self, idx: NSUInteger, object: &ObjectType);
674
675 #[cfg(feature = "NSCoder")]
676 #[unsafe(method(initWithCoder:))]
677 #[unsafe(method_family = init)]
678 pub unsafe fn initWithCoder(
679 this: Allocated<Self>,
680 coder: &NSCoder,
681 ) -> Option<Retained<Self>>;
682
683 #[unsafe(method(init))]
684 #[unsafe(method_family = init)]
685 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
686
687 #[unsafe(method(initWithCapacity:))]
688 #[unsafe(method_family = init)]
689 pub unsafe fn initWithCapacity(
690 this: Allocated<Self>,
691 num_items: NSUInteger,
692 ) -> Retained<Self>;
693 );
694}
695
696impl<ObjectType: Message> NSMutableOrderedSet<ObjectType> {
698 extern_methods!(
699 #[unsafe(method(initWithObjects:count:))]
700 #[unsafe(method_family = init)]
701 pub unsafe fn initWithObjects_count(
702 this: Allocated<Self>,
703 objects: *mut NonNull<ObjectType>,
704 cnt: NSUInteger,
705 ) -> Retained<Self>;
706 );
707}
708
709impl<ObjectType: Message> NSMutableOrderedSet<ObjectType> {
711 extern_methods!(
712 #[unsafe(method(new))]
713 #[unsafe(method_family = new)]
714 pub unsafe fn new() -> Retained<Self>;
715 );
716}
717
718impl<ObjectType: Message> NSMutableOrderedSet<ObjectType> {
720 extern_methods!(
721 #[unsafe(method(addObject:))]
722 #[unsafe(method_family = none)]
723 pub unsafe fn addObject(&self, object: &ObjectType);
724
725 #[unsafe(method(addObjects:count:))]
726 #[unsafe(method_family = none)]
727 pub unsafe fn addObjects_count(&self, objects: *mut NonNull<ObjectType>, count: NSUInteger);
728
729 #[cfg(feature = "NSArray")]
730 #[unsafe(method(addObjectsFromArray:))]
731 #[unsafe(method_family = none)]
732 pub unsafe fn addObjectsFromArray(&self, array: &NSArray<ObjectType>);
733
734 #[unsafe(method(exchangeObjectAtIndex:withObjectAtIndex:))]
735 #[unsafe(method_family = none)]
736 pub unsafe fn exchangeObjectAtIndex_withObjectAtIndex(
737 &self,
738 idx1: NSUInteger,
739 idx2: NSUInteger,
740 );
741
742 #[cfg(feature = "NSIndexSet")]
743 #[unsafe(method(moveObjectsAtIndexes:toIndex:))]
744 #[unsafe(method_family = none)]
745 pub unsafe fn moveObjectsAtIndexes_toIndex(&self, indexes: &NSIndexSet, idx: NSUInteger);
746
747 #[cfg(all(feature = "NSArray", feature = "NSIndexSet"))]
748 #[unsafe(method(insertObjects:atIndexes:))]
749 #[unsafe(method_family = none)]
750 pub unsafe fn insertObjects_atIndexes(
751 &self,
752 objects: &NSArray<ObjectType>,
753 indexes: &NSIndexSet,
754 );
755
756 #[unsafe(method(setObject:atIndex:))]
757 #[unsafe(method_family = none)]
758 pub unsafe fn setObject_atIndex(&self, obj: &ObjectType, idx: NSUInteger);
759
760 #[unsafe(method(setObject:atIndexedSubscript:))]
761 #[unsafe(method_family = none)]
762 pub unsafe fn setObject_atIndexedSubscript(&self, obj: &ObjectType, idx: NSUInteger);
763
764 #[cfg(feature = "NSRange")]
765 #[unsafe(method(replaceObjectsInRange:withObjects:count:))]
766 #[unsafe(method_family = none)]
767 pub unsafe fn replaceObjectsInRange_withObjects_count(
768 &self,
769 range: NSRange,
770 objects: *mut NonNull<ObjectType>,
771 count: NSUInteger,
772 );
773
774 #[cfg(all(feature = "NSArray", feature = "NSIndexSet"))]
775 #[unsafe(method(replaceObjectsAtIndexes:withObjects:))]
776 #[unsafe(method_family = none)]
777 pub unsafe fn replaceObjectsAtIndexes_withObjects(
778 &self,
779 indexes: &NSIndexSet,
780 objects: &NSArray<ObjectType>,
781 );
782
783 #[cfg(feature = "NSRange")]
784 #[unsafe(method(removeObjectsInRange:))]
785 #[unsafe(method_family = none)]
786 pub unsafe fn removeObjectsInRange(&self, range: NSRange);
787
788 #[cfg(feature = "NSIndexSet")]
789 #[unsafe(method(removeObjectsAtIndexes:))]
790 #[unsafe(method_family = none)]
791 pub unsafe fn removeObjectsAtIndexes(&self, indexes: &NSIndexSet);
792
793 #[unsafe(method(removeAllObjects))]
794 #[unsafe(method_family = none)]
795 pub unsafe fn removeAllObjects(&self);
796
797 #[unsafe(method(removeObject:))]
798 #[unsafe(method_family = none)]
799 pub unsafe fn removeObject(&self, object: &ObjectType);
800
801 #[cfg(feature = "NSArray")]
802 #[unsafe(method(removeObjectsInArray:))]
803 #[unsafe(method_family = none)]
804 pub unsafe fn removeObjectsInArray(&self, array: &NSArray<ObjectType>);
805
806 #[unsafe(method(intersectOrderedSet:))]
807 #[unsafe(method_family = none)]
808 pub unsafe fn intersectOrderedSet(&self, other: &NSOrderedSet<ObjectType>);
809
810 #[unsafe(method(minusOrderedSet:))]
811 #[unsafe(method_family = none)]
812 pub unsafe fn minusOrderedSet(&self, other: &NSOrderedSet<ObjectType>);
813
814 #[unsafe(method(unionOrderedSet:))]
815 #[unsafe(method_family = none)]
816 pub unsafe fn unionOrderedSet(&self, other: &NSOrderedSet<ObjectType>);
817
818 #[cfg(feature = "NSSet")]
819 #[unsafe(method(intersectSet:))]
820 #[unsafe(method_family = none)]
821 pub unsafe fn intersectSet(&self, other: &NSSet<ObjectType>);
822
823 #[cfg(feature = "NSSet")]
824 #[unsafe(method(minusSet:))]
825 #[unsafe(method_family = none)]
826 pub unsafe fn minusSet(&self, other: &NSSet<ObjectType>);
827
828 #[cfg(feature = "NSSet")]
829 #[unsafe(method(unionSet:))]
830 #[unsafe(method_family = none)]
831 pub unsafe fn unionSet(&self, other: &NSSet<ObjectType>);
832
833 #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
834 #[unsafe(method(sortUsingComparator:))]
835 #[unsafe(method_family = none)]
836 pub unsafe fn sortUsingComparator(&self, cmptr: NSComparator);
837
838 #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
839 #[unsafe(method(sortWithOptions:usingComparator:))]
840 #[unsafe(method_family = none)]
841 pub unsafe fn sortWithOptions_usingComparator(
842 &self,
843 opts: NSSortOptions,
844 cmptr: NSComparator,
845 );
846
847 #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
848 #[unsafe(method(sortRange:options:usingComparator:))]
849 #[unsafe(method_family = none)]
850 pub unsafe fn sortRange_options_usingComparator(
851 &self,
852 range: NSRange,
853 opts: NSSortOptions,
854 cmptr: NSComparator,
855 );
856 );
857}
858
859impl<ObjectType: Message> NSMutableOrderedSet<ObjectType> {
861 extern_methods!(
862 #[unsafe(method(orderedSetWithCapacity:))]
863 #[unsafe(method_family = none)]
864 pub unsafe fn orderedSetWithCapacity(num_items: NSUInteger) -> Retained<Self>;
865 );
866}
867
868impl<ObjectType: Message> NSMutableOrderedSet<ObjectType> {
870 extern_methods!(
871 #[cfg(feature = "NSOrderedCollectionDifference")]
872 #[unsafe(method(applyDifference:))]
873 #[unsafe(method_family = none)]
874 pub unsafe fn applyDifference(
875 &self,
876 difference: &NSOrderedCollectionDifference<ObjectType>,
877 );
878 );
879}