objc2_foundation/generated/
NSOrderedCollectionChange.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8#[repr(transparent)]
11#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
12pub struct NSCollectionChangeType(pub NSInteger);
13impl NSCollectionChangeType {
14 #[doc(alias = "NSCollectionChangeInsert")]
15 pub const Insert: Self = Self(0);
16 #[doc(alias = "NSCollectionChangeRemove")]
17 pub const Remove: Self = Self(1);
18}
19
20unsafe impl Encode for NSCollectionChangeType {
21 const ENCODING: Encoding = NSInteger::ENCODING;
22}
23
24unsafe impl RefEncode for NSCollectionChangeType {
25 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
26}
27
28extern_class!(
29 #[unsafe(super(NSObject))]
31 #[derive(Debug, PartialEq, Eq, Hash)]
32 pub struct NSOrderedCollectionChange<ObjectType: ?Sized = AnyObject>;
33);
34
35impl<ObjectType: ?Sized + Message> NSOrderedCollectionChange<ObjectType> {
36 #[inline]
42 pub unsafe fn cast_unchecked<NewObjectType: ?Sized + Message>(
43 &self,
44 ) -> &NSOrderedCollectionChange<NewObjectType> {
45 unsafe { &*((self as *const Self).cast()) }
46 }
47}
48
49extern_conformance!(
50 unsafe impl<ObjectType: ?Sized> NSObjectProtocol for NSOrderedCollectionChange<ObjectType> {}
51);
52
53impl<ObjectType: Message> NSOrderedCollectionChange<ObjectType> {
54 extern_methods!(
55 #[unsafe(method(changeWithObject:type:index:))]
56 #[unsafe(method_family = none)]
57 pub fn changeWithObject_type_index(
58 an_object: Option<&ObjectType>,
59 r#type: NSCollectionChangeType,
60 index: NSUInteger,
61 ) -> Retained<NSOrderedCollectionChange<ObjectType>>;
62
63 #[unsafe(method(changeWithObject:type:index:associatedIndex:))]
64 #[unsafe(method_family = none)]
65 pub fn changeWithObject_type_index_associatedIndex(
66 an_object: Option<&ObjectType>,
67 r#type: NSCollectionChangeType,
68 index: NSUInteger,
69 associated_index: NSUInteger,
70 ) -> Retained<NSOrderedCollectionChange<ObjectType>>;
71
72 #[unsafe(method(object))]
73 #[unsafe(method_family = none)]
74 pub fn object(&self) -> Option<Retained<ObjectType>>;
75
76 #[unsafe(method(changeType))]
77 #[unsafe(method_family = none)]
78 pub fn changeType(&self) -> NSCollectionChangeType;
79
80 #[unsafe(method(index))]
81 #[unsafe(method_family = none)]
82 pub fn index(&self) -> NSUInteger;
83
84 #[unsafe(method(associatedIndex))]
85 #[unsafe(method_family = none)]
86 pub fn associatedIndex(&self) -> NSUInteger;
87
88 #[unsafe(method(init))]
89 #[unsafe(method_family = init)]
90 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
91
92 #[unsafe(method(initWithObject:type:index:))]
93 #[unsafe(method_family = init)]
94 pub fn initWithObject_type_index(
95 this: Allocated<Self>,
96 an_object: Option<&ObjectType>,
97 r#type: NSCollectionChangeType,
98 index: NSUInteger,
99 ) -> Retained<Self>;
100
101 #[unsafe(method(initWithObject:type:index:associatedIndex:))]
102 #[unsafe(method_family = init)]
103 pub fn initWithObject_type_index_associatedIndex(
104 this: Allocated<Self>,
105 an_object: Option<&ObjectType>,
106 r#type: NSCollectionChangeType,
107 index: NSUInteger,
108 associated_index: NSUInteger,
109 ) -> Retained<Self>;
110 );
111}
112
113impl<ObjectType: Message> NSOrderedCollectionChange<ObjectType> {
115 extern_methods!(
116 #[unsafe(method(new))]
117 #[unsafe(method_family = new)]
118 pub unsafe fn new() -> Retained<Self>;
119 );
120}