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")]
109extern_conformance!(
110    unsafe impl NSCoding for NSException {}
111);
112
113#[cfg(feature = "NSObject")]
114extern_conformance!(
115    unsafe impl NSCopying for NSException {}
116);
117
118#[cfg(feature = "NSObject")]
119unsafe impl CopyingHelper for NSException {
120    type Result = Self;
121}
122
123extern_conformance!(
124    unsafe impl NSObjectProtocol for NSException {}
125);
126
127#[cfg(feature = "NSObject")]
128extern_conformance!(
129    unsafe impl NSSecureCoding for NSException {}
130);
131
132impl NSException {
133    extern_methods!(
134        #[cfg(all(
135            feature = "NSDictionary",
136            feature = "NSObjCRuntime",
137            feature = "NSString"
138        ))]
139        #[unsafe(method(exceptionWithName:reason:userInfo:))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn exceptionWithName_reason_userInfo(
142            name: &NSExceptionName,
143            reason: Option<&NSString>,
144            user_info: Option<&NSDictionary>,
145        ) -> Retained<NSException>;
146
147        #[cfg(all(
148            feature = "NSDictionary",
149            feature = "NSObjCRuntime",
150            feature = "NSString"
151        ))]
152        #[unsafe(method(initWithName:reason:userInfo:))]
153        #[unsafe(method_family = init)]
154        pub unsafe fn initWithName_reason_userInfo(
155            this: Allocated<Self>,
156            a_name: &NSExceptionName,
157            a_reason: Option<&NSString>,
158            a_user_info: Option<&NSDictionary>,
159        ) -> Retained<Self>;
160
161        #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
162        #[unsafe(method(name))]
163        #[unsafe(method_family = none)]
164        pub fn name(&self) -> Retained<NSExceptionName>;
165
166        #[cfg(feature = "NSString")]
167        #[unsafe(method(reason))]
168        #[unsafe(method_family = none)]
169        pub fn reason(&self) -> Option<Retained<NSString>>;
170
171        #[cfg(feature = "NSDictionary")]
172        #[unsafe(method(userInfo))]
173        #[unsafe(method_family = none)]
174        pub fn userInfo(&self) -> Option<Retained<NSDictionary>>;
175
176        #[cfg(all(feature = "NSArray", feature = "NSValue"))]
177        #[unsafe(method(callStackReturnAddresses))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn callStackReturnAddresses(&self) -> Retained<NSArray<NSNumber>>;
180
181        #[cfg(all(feature = "NSArray", feature = "NSString"))]
182        #[unsafe(method(callStackSymbols))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn callStackSymbols(&self) -> Retained<NSArray<NSString>>;
185    );
186}
187
188/// Methods declared on superclass `NSObject`.
189impl NSException {
190    extern_methods!(
191        #[unsafe(method(init))]
192        #[unsafe(method_family = init)]
193        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
194    );
195}
196
197/// NSExceptionRaisingConveniences.
198impl NSException {
199    extern_methods!();
200}
201
202/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsuncaughtexceptionhandler?language=objc)
203pub type NSUncaughtExceptionHandler = core::ffi::c_void;
204
205extern "C-unwind" {
206    pub fn NSGetUncaughtExceptionHandler() -> *mut NSUncaughtExceptionHandler;
207}
208
209extern "C-unwind" {
210    pub fn NSSetUncaughtExceptionHandler(param1: *mut NSUncaughtExceptionHandler);
211}
212
213extern "C" {
214    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsassertionhandlerkey?language=objc)
215    #[cfg(feature = "NSString")]
216    pub static NSAssertionHandlerKey: &'static NSString;
217}
218
219extern_class!(
220    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsassertionhandler?language=objc)
221    #[unsafe(super(NSObject))]
222    #[derive(Debug, PartialEq, Eq, Hash)]
223    pub struct NSAssertionHandler;
224);
225
226extern_conformance!(
227    unsafe impl NSObjectProtocol for NSAssertionHandler {}
228);
229
230impl NSAssertionHandler {
231    extern_methods!(
232        #[unsafe(method(currentHandler))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn currentHandler() -> Retained<NSAssertionHandler>;
235    );
236}
237
238/// Methods declared on superclass `NSObject`.
239impl NSAssertionHandler {
240    extern_methods!(
241        #[unsafe(method(init))]
242        #[unsafe(method_family = init)]
243        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
244
245        #[unsafe(method(new))]
246        #[unsafe(method_family = new)]
247        pub unsafe fn new() -> Retained<Self>;
248    );
249}