objc2_foundation/generated/
NSOrderedCollectionDifference.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSOrderedCollectionDifferenceCalculationOptions(pub NSUInteger);
15bitflags::bitflags! {
16 impl NSOrderedCollectionDifferenceCalculationOptions: NSUInteger {
17#[doc(alias = "NSOrderedCollectionDifferenceCalculationOmitInsertedObjects")]
19 const OmitInsertedObjects = 1<<0;
20#[doc(alias = "NSOrderedCollectionDifferenceCalculationOmitRemovedObjects")]
22 const OmitRemovedObjects = 1<<1;
23#[doc(alias = "NSOrderedCollectionDifferenceCalculationInferMoves")]
26 const InferMoves = 1<<2;
27 }
28}
29
30unsafe impl Encode for NSOrderedCollectionDifferenceCalculationOptions {
31 const ENCODING: Encoding = NSUInteger::ENCODING;
32}
33
34unsafe impl RefEncode for NSOrderedCollectionDifferenceCalculationOptions {
35 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
36}
37
38extern_class!(
39 #[unsafe(super(NSObject))]
41 #[derive(Debug, PartialEq, Eq, Hash)]
42 pub struct NSOrderedCollectionDifference<ObjectType: ?Sized = AnyObject>;
43);
44
45#[cfg(feature = "NSEnumerator")]
46unsafe impl<ObjectType: ?Sized> NSFastEnumeration for NSOrderedCollectionDifference<ObjectType> {}
47
48unsafe impl<ObjectType: ?Sized> NSObjectProtocol for NSOrderedCollectionDifference<ObjectType> {}
49
50impl<ObjectType: Message> NSOrderedCollectionDifference<ObjectType> {
51 extern_methods!(
52 #[cfg(all(feature = "NSArray", feature = "NSOrderedCollectionChange"))]
53 #[unsafe(method(initWithChanges:))]
66 #[unsafe(method_family = init)]
67 pub unsafe fn initWithChanges(
68 this: Allocated<Self>,
69 changes: &NSArray<NSOrderedCollectionChange<ObjectType>>,
70 ) -> Retained<Self>;
71
72 #[cfg(all(
73 feature = "NSArray",
74 feature = "NSIndexSet",
75 feature = "NSOrderedCollectionChange"
76 ))]
77 #[unsafe(method(initWithInsertIndexes:insertedObjects:removeIndexes:removedObjects:additionalChanges:))]
78 #[unsafe(method_family = init)]
79 pub unsafe fn initWithInsertIndexes_insertedObjects_removeIndexes_removedObjects_additionalChanges(
80 this: Allocated<Self>,
81 inserts: &NSIndexSet,
82 inserted_objects: Option<&NSArray<ObjectType>>,
83 removes: &NSIndexSet,
84 removed_objects: Option<&NSArray<ObjectType>>,
85 changes: &NSArray<NSOrderedCollectionChange<ObjectType>>,
86 ) -> Retained<Self>;
87
88 #[cfg(all(feature = "NSArray", feature = "NSIndexSet"))]
89 #[unsafe(method(initWithInsertIndexes:insertedObjects:removeIndexes:removedObjects:))]
90 #[unsafe(method_family = init)]
91 pub unsafe fn initWithInsertIndexes_insertedObjects_removeIndexes_removedObjects(
92 this: Allocated<Self>,
93 inserts: &NSIndexSet,
94 inserted_objects: Option<&NSArray<ObjectType>>,
95 removes: &NSIndexSet,
96 removed_objects: Option<&NSArray<ObjectType>>,
97 ) -> Retained<Self>;
98
99 #[cfg(all(feature = "NSArray", feature = "NSOrderedCollectionChange"))]
100 #[unsafe(method(insertions))]
101 #[unsafe(method_family = none)]
102 pub unsafe fn insertions(&self)
103 -> Retained<NSArray<NSOrderedCollectionChange<ObjectType>>>;
104
105 #[cfg(all(feature = "NSArray", feature = "NSOrderedCollectionChange"))]
106 #[unsafe(method(removals))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn removals(&self) -> Retained<NSArray<NSOrderedCollectionChange<ObjectType>>>;
109
110 #[unsafe(method(hasChanges))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn hasChanges(&self) -> bool;
113
114 #[cfg(all(feature = "NSOrderedCollectionChange", feature = "block2"))]
115 #[unsafe(method(differenceByTransformingChangesWithBlock:))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn differenceByTransformingChangesWithBlock(
118 &self,
119 block: &block2::Block<
120 dyn Fn(
121 NonNull<NSOrderedCollectionChange<ObjectType>>,
122 ) -> NonNull<NSOrderedCollectionChange<AnyObject>>
123 + '_,
124 >,
125 ) -> Retained<NSOrderedCollectionDifference<AnyObject>>;
126
127 #[unsafe(method(inverseDifference))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn inverseDifference(&self) -> Retained<Self>;
130 );
131}
132
133impl<ObjectType: Message> NSOrderedCollectionDifference<ObjectType> {
135 extern_methods!(
136 #[unsafe(method(init))]
137 #[unsafe(method_family = init)]
138 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
139
140 #[unsafe(method(new))]
141 #[unsafe(method_family = new)]
142 pub unsafe fn new() -> Retained<Self>;
143 );
144}