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")]
46extern_conformance!(
47 unsafe impl<ObjectType: ?Sized> NSFastEnumeration for NSOrderedCollectionDifference<ObjectType> {}
48);
49
50extern_conformance!(
51 unsafe impl<ObjectType: ?Sized> NSObjectProtocol for NSOrderedCollectionDifference<ObjectType> {}
52);
53
54impl<ObjectType: Message> NSOrderedCollectionDifference<ObjectType> {
55 extern_methods!(
56 #[cfg(all(feature = "NSArray", feature = "NSOrderedCollectionChange"))]
57 #[unsafe(method(initWithChanges:))]
70 #[unsafe(method_family = init)]
71 pub unsafe fn initWithChanges(
72 this: Allocated<Self>,
73 changes: &NSArray<NSOrderedCollectionChange<ObjectType>>,
74 ) -> Retained<Self>;
75
76 #[cfg(all(
77 feature = "NSArray",
78 feature = "NSIndexSet",
79 feature = "NSOrderedCollectionChange"
80 ))]
81 #[unsafe(method(initWithInsertIndexes:insertedObjects:removeIndexes:removedObjects:additionalChanges:))]
82 #[unsafe(method_family = init)]
83 pub unsafe fn initWithInsertIndexes_insertedObjects_removeIndexes_removedObjects_additionalChanges(
84 this: Allocated<Self>,
85 inserts: &NSIndexSet,
86 inserted_objects: Option<&NSArray<ObjectType>>,
87 removes: &NSIndexSet,
88 removed_objects: Option<&NSArray<ObjectType>>,
89 changes: &NSArray<NSOrderedCollectionChange<ObjectType>>,
90 ) -> Retained<Self>;
91
92 #[cfg(all(feature = "NSArray", feature = "NSIndexSet"))]
93 #[unsafe(method(initWithInsertIndexes:insertedObjects:removeIndexes:removedObjects:))]
94 #[unsafe(method_family = init)]
95 pub unsafe fn initWithInsertIndexes_insertedObjects_removeIndexes_removedObjects(
96 this: Allocated<Self>,
97 inserts: &NSIndexSet,
98 inserted_objects: Option<&NSArray<ObjectType>>,
99 removes: &NSIndexSet,
100 removed_objects: Option<&NSArray<ObjectType>>,
101 ) -> Retained<Self>;
102
103 #[cfg(all(feature = "NSArray", feature = "NSOrderedCollectionChange"))]
104 #[unsafe(method(insertions))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn insertions(&self)
107 -> Retained<NSArray<NSOrderedCollectionChange<ObjectType>>>;
108
109 #[cfg(all(feature = "NSArray", feature = "NSOrderedCollectionChange"))]
110 #[unsafe(method(removals))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn removals(&self) -> Retained<NSArray<NSOrderedCollectionChange<ObjectType>>>;
113
114 #[unsafe(method(hasChanges))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn hasChanges(&self) -> bool;
117
118 #[cfg(all(feature = "NSOrderedCollectionChange", feature = "block2"))]
119 #[unsafe(method(differenceByTransformingChangesWithBlock:))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn differenceByTransformingChangesWithBlock(
122 &self,
123 block: &block2::DynBlock<
124 dyn Fn(
125 NonNull<NSOrderedCollectionChange<ObjectType>>,
126 ) -> NonNull<NSOrderedCollectionChange<AnyObject>>
127 + '_,
128 >,
129 ) -> Retained<NSOrderedCollectionDifference<AnyObject>>;
130
131 #[unsafe(method(inverseDifference))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn inverseDifference(&self) -> Retained<Self>;
134 );
135}
136
137impl<ObjectType: Message> NSOrderedCollectionDifference<ObjectType> {
139 extern_methods!(
140 #[unsafe(method(init))]
141 #[unsafe(method_family = init)]
142 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
143
144 #[unsafe(method(new))]
145 #[unsafe(method_family = new)]
146 pub unsafe fn new() -> Retained<Self>;
147 );
148}