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