objc2_exception_handling/generated/
NSExceptionHandler.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nslogandhandleeveryexceptionmask?language=objc)
11pub const NSLogAndHandleEveryExceptionMask: c_uint = NSLogUncaughtExceptionMask
12    | NSLogUncaughtSystemExceptionMask
13    | NSLogUncaughtRuntimeErrorMask
14    | NSHandleUncaughtExceptionMask
15    | NSHandleUncaughtSystemExceptionMask
16    | NSHandleUncaughtRuntimeErrorMask
17    | NSLogTopLevelExceptionMask
18    | NSHandleTopLevelExceptionMask
19    | NSLogOtherExceptionMask
20    | NSHandleOtherExceptionMask;
21/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nshangoneveryexceptionmask?language=objc)
22pub const NSHangOnEveryExceptionMask: c_uint = NSHangOnUncaughtExceptionMask
23    | NSHangOnUncaughtSystemExceptionMask
24    | NSHangOnUncaughtRuntimeErrorMask
25    | NSHangOnTopLevelExceptionMask
26    | NSHangOnOtherExceptionMask;
27extern "C" {
28    /// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nsuncaughtsystemexceptionexception?language=objc)
29    pub static NSUncaughtSystemExceptionException: Option<&'static NSString>;
30}
31
32extern "C" {
33    /// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nsuncaughtruntimeerrorexception?language=objc)
34    pub static NSUncaughtRuntimeErrorException: Option<&'static NSString>;
35}
36
37extern "C" {
38    /// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nsstacktracekey?language=objc)
39    pub static NSStackTraceKey: Option<&'static NSString>;
40}
41
42impl NSExceptionHandler {
43    #[doc(alias = "NSExceptionHandlerResume")]
44    #[inline]
45    pub unsafe fn resume() {
46        extern "C-unwind" {
47            fn NSExceptionHandlerResume();
48        }
49        unsafe { NSExceptionHandlerResume() }
50    }
51}
52
53/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nsloguncaughtexceptionmask?language=objc)
54pub const NSLogUncaughtExceptionMask: c_uint = 1 << 0;
55/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nshandleuncaughtexceptionmask?language=objc)
56pub const NSHandleUncaughtExceptionMask: c_uint = 1 << 1;
57/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nsloguncaughtsystemexceptionmask?language=objc)
58pub const NSLogUncaughtSystemExceptionMask: c_uint = 1 << 2;
59/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nshandleuncaughtsystemexceptionmask?language=objc)
60pub const NSHandleUncaughtSystemExceptionMask: c_uint = 1 << 3;
61/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nsloguncaughtruntimeerrormask?language=objc)
62pub const NSLogUncaughtRuntimeErrorMask: c_uint = 1 << 4;
63/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nshandleuncaughtruntimeerrormask?language=objc)
64pub const NSHandleUncaughtRuntimeErrorMask: c_uint = 1 << 5;
65/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nslogtoplevelexceptionmask?language=objc)
66pub const NSLogTopLevelExceptionMask: c_uint = 1 << 6;
67/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nshandletoplevelexceptionmask?language=objc)
68pub const NSHandleTopLevelExceptionMask: c_uint = 1 << 7;
69/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nslogotherexceptionmask?language=objc)
70pub const NSLogOtherExceptionMask: c_uint = 1 << 8;
71/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nshandleotherexceptionmask?language=objc)
72pub const NSHandleOtherExceptionMask: c_uint = 1 << 9;
73
74/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nshangonuncaughtexceptionmask?language=objc)
75pub const NSHangOnUncaughtExceptionMask: c_uint = 1 << 0;
76/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nshangonuncaughtsystemexceptionmask?language=objc)
77pub const NSHangOnUncaughtSystemExceptionMask: c_uint = 1 << 1;
78/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nshangonuncaughtruntimeerrormask?language=objc)
79pub const NSHangOnUncaughtRuntimeErrorMask: c_uint = 1 << 2;
80/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nshangontoplevelexceptionmask?language=objc)
81pub const NSHangOnTopLevelExceptionMask: c_uint = 1 << 3;
82/// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nshangonotherexceptionmask?language=objc)
83pub const NSHangOnOtherExceptionMask: c_uint = 1 << 4;
84
85extern_class!(
86    /// [Apple's documentation](https://developer.apple.com/documentation/exceptionhandling/nsexceptionhandler?language=objc)
87    #[unsafe(super(NSObject))]
88    #[derive(Debug, PartialEq, Eq, Hash)]
89    pub struct NSExceptionHandler;
90);
91
92extern_conformance!(
93    unsafe impl NSObjectProtocol for NSExceptionHandler {}
94);
95
96impl NSExceptionHandler {
97    extern_methods!(
98        #[unsafe(method(defaultExceptionHandler))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn defaultExceptionHandler() -> Option<Retained<NSExceptionHandler>>;
101
102        #[unsafe(method(setExceptionHandlingMask:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn setExceptionHandlingMask(&self, a_mask: NSUInteger);
105
106        #[unsafe(method(exceptionHandlingMask))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn exceptionHandlingMask(&self) -> NSUInteger;
109
110        #[unsafe(method(setExceptionHangingMask:))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn setExceptionHangingMask(&self, a_mask: NSUInteger);
113
114        #[unsafe(method(exceptionHangingMask))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn exceptionHangingMask(&self) -> NSUInteger;
117
118        #[unsafe(method(setDelegate:))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn setDelegate(&self, an_object: Option<&AnyObject>);
121
122        #[unsafe(method(delegate))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn delegate(&self) -> Option<Retained<AnyObject>>;
125    );
126}
127
128/// Methods declared on superclass `NSObject`.
129impl NSExceptionHandler {
130    extern_methods!(
131        #[unsafe(method(init))]
132        #[unsafe(method_family = init)]
133        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
134
135        #[unsafe(method(new))]
136        #[unsafe(method_family = new)]
137        pub unsafe fn new() -> Retained<Self>;
138    );
139}
140
141mod private_NSObjectNSExceptionHandlerDelegate {
142    pub trait Sealed {}
143}
144
145/// Category "NSExceptionHandlerDelegate" on [`NSObject`].
146#[doc(alias = "NSExceptionHandlerDelegate")]
147pub unsafe trait NSObjectNSExceptionHandlerDelegate:
148    ClassType + Sized + private_NSObjectNSExceptionHandlerDelegate::Sealed
149{
150    extern_methods!(
151        #[unsafe(method(exceptionHandler:shouldLogException:mask:))]
152        #[unsafe(method_family = none)]
153        unsafe fn exceptionHandler_shouldLogException_mask(
154            &self,
155            sender: Option<&NSExceptionHandler>,
156            exception: Option<&NSException>,
157            a_mask: NSUInteger,
158        ) -> bool;
159
160        #[unsafe(method(exceptionHandler:shouldHandleException:mask:))]
161        #[unsafe(method_family = none)]
162        unsafe fn exceptionHandler_shouldHandleException_mask(
163            &self,
164            sender: Option<&NSExceptionHandler>,
165            exception: Option<&NSException>,
166            a_mask: NSUInteger,
167        ) -> bool;
168    );
169}
170
171impl private_NSObjectNSExceptionHandlerDelegate::Sealed for NSObject {}
172unsafe impl NSObjectNSExceptionHandlerDelegate for NSObject {}
173
174extern "C-unwind" {
175    #[deprecated = "renamed to `NSExceptionHandler::resume`"]
176    pub fn NSExceptionHandlerResume();
177}