objc2_foundation/generated/
NSException.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern "C" {
10    /// *************    Generic Exception names        **************
11    ///
12    /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsgenericexception?language=objc)
13    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
14    pub static NSGenericException: &'static NSExceptionName;
15}
16
17extern "C" {
18    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsrangeexception?language=objc)
19    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
20    pub static NSRangeException: &'static NSExceptionName;
21}
22
23extern "C" {
24    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinvalidargumentexception?language=objc)
25    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
26    pub static NSInvalidArgumentException: &'static NSExceptionName;
27}
28
29extern "C" {
30    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinternalinconsistencyexception?language=objc)
31    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
32    pub static NSInternalInconsistencyException: &'static NSExceptionName;
33}
34
35extern "C" {
36    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmallocexception?language=objc)
37    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
38    pub static NSMallocException: &'static NSExceptionName;
39}
40
41extern "C" {
42    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsobjectinaccessibleexception?language=objc)
43    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
44    pub static NSObjectInaccessibleException: &'static NSExceptionName;
45}
46
47extern "C" {
48    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsobjectnotavailableexception?language=objc)
49    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
50    pub static NSObjectNotAvailableException: &'static NSExceptionName;
51}
52
53extern "C" {
54    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsdestinationinvalidexception?language=objc)
55    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
56    pub static NSDestinationInvalidException: &'static NSExceptionName;
57}
58
59extern "C" {
60    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsporttimeoutexception?language=objc)
61    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
62    pub static NSPortTimeoutException: &'static NSExceptionName;
63}
64
65extern "C" {
66    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinvalidsendportexception?language=objc)
67    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
68    pub static NSInvalidSendPortException: &'static NSExceptionName;
69}
70
71extern "C" {
72    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinvalidreceiveportexception?language=objc)
73    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
74    pub static NSInvalidReceivePortException: &'static NSExceptionName;
75}
76
77extern "C" {
78    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsportsendexception?language=objc)
79    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
80    pub static NSPortSendException: &'static NSExceptionName;
81}
82
83extern "C" {
84    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsportreceiveexception?language=objc)
85    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
86    pub static NSPortReceiveException: &'static NSExceptionName;
87}
88
89extern "C" {
90    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsoldstyleexception?language=objc)
91    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
92    pub static NSOldStyleException: &'static NSExceptionName;
93}
94
95extern "C" {
96    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinconsistentarchiveexception?language=objc)
97    #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
98    pub static NSInconsistentArchiveException: &'static NSExceptionName;
99}
100
101extern_class!(
102    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsexception?language=objc)
103    #[unsafe(super(NSObject))]
104    #[derive(PartialEq, Eq, Hash)]
105    pub struct NSException;
106);
107
108#[cfg(feature = "NSObject")]
109unsafe impl NSCoding for NSException {}
110
111#[cfg(feature = "NSObject")]
112unsafe impl NSCopying for NSException {}
113
114#[cfg(feature = "NSObject")]
115unsafe impl CopyingHelper for NSException {
116    type Result = Self;
117}
118
119unsafe impl NSObjectProtocol for NSException {}
120
121#[cfg(feature = "NSObject")]
122unsafe impl NSSecureCoding for NSException {}
123
124impl NSException {
125    extern_methods!(
126        #[cfg(all(
127            feature = "NSDictionary",
128            feature = "NSObjCRuntime",
129            feature = "NSString"
130        ))]
131        #[unsafe(method(exceptionWithName:reason:userInfo:))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn exceptionWithName_reason_userInfo(
134            name: &NSExceptionName,
135            reason: Option<&NSString>,
136            user_info: Option<&NSDictionary>,
137        ) -> Retained<NSException>;
138
139        #[cfg(all(
140            feature = "NSDictionary",
141            feature = "NSObjCRuntime",
142            feature = "NSString"
143        ))]
144        #[unsafe(method(initWithName:reason:userInfo:))]
145        #[unsafe(method_family = init)]
146        pub unsafe fn initWithName_reason_userInfo(
147            this: Allocated<Self>,
148            a_name: &NSExceptionName,
149            a_reason: Option<&NSString>,
150            a_user_info: Option<&NSDictionary>,
151        ) -> Retained<Self>;
152
153        #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
154        #[unsafe(method(name))]
155        #[unsafe(method_family = none)]
156        pub fn name(&self) -> Retained<NSExceptionName>;
157
158        #[cfg(feature = "NSString")]
159        #[unsafe(method(reason))]
160        #[unsafe(method_family = none)]
161        pub fn reason(&self) -> Option<Retained<NSString>>;
162
163        #[cfg(feature = "NSDictionary")]
164        #[unsafe(method(userInfo))]
165        #[unsafe(method_family = none)]
166        pub fn userInfo(&self) -> Option<Retained<NSDictionary>>;
167
168        #[cfg(all(feature = "NSArray", feature = "NSValue"))]
169        #[unsafe(method(callStackReturnAddresses))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn callStackReturnAddresses(&self) -> Retained<NSArray<NSNumber>>;
172
173        #[cfg(all(feature = "NSArray", feature = "NSString"))]
174        #[unsafe(method(callStackSymbols))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn callStackSymbols(&self) -> Retained<NSArray<NSString>>;
177    );
178}
179
180/// Methods declared on superclass `NSObject`.
181impl NSException {
182    extern_methods!(
183        #[unsafe(method(init))]
184        #[unsafe(method_family = init)]
185        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
186    );
187}
188
189/// NSExceptionRaisingConveniences.
190impl NSException {
191    extern_methods!();
192}
193
194/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsuncaughtexceptionhandler?language=objc)
195pub type NSUncaughtExceptionHandler = core::ffi::c_void;
196
197extern "C-unwind" {
198    pub fn NSGetUncaughtExceptionHandler() -> *mut NSUncaughtExceptionHandler;
199}
200
201extern "C-unwind" {
202    pub fn NSSetUncaughtExceptionHandler(param1: *mut NSUncaughtExceptionHandler);
203}
204
205extern "C" {
206    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsassertionhandlerkey?language=objc)
207    #[cfg(feature = "NSString")]
208    pub static NSAssertionHandlerKey: &'static NSString;
209}
210
211extern_class!(
212    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsassertionhandler?language=objc)
213    #[unsafe(super(NSObject))]
214    #[derive(Debug, PartialEq, Eq, Hash)]
215    pub struct NSAssertionHandler;
216);
217
218unsafe impl NSObjectProtocol for NSAssertionHandler {}
219
220impl NSAssertionHandler {
221    extern_methods!(
222        #[unsafe(method(currentHandler))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn currentHandler() -> Retained<NSAssertionHandler>;
225    );
226}
227
228/// Methods declared on superclass `NSObject`.
229impl NSAssertionHandler {
230    extern_methods!(
231        #[unsafe(method(init))]
232        #[unsafe(method_family = init)]
233        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
234
235        #[unsafe(method(new))]
236        #[unsafe(method_family = new)]
237        pub unsafe fn new() -> Retained<Self>;
238    );
239}