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        /// # Safety
119        ///
120        /// - `an_object` should be of the correct type.
121        /// - `an_object` might not allow `None`.
122        #[unsafe(method(setDelegate:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn setDelegate(&self, an_object: Option<&AnyObject>);
125
126        #[unsafe(method(delegate))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn delegate(&self) -> Option<Retained<AnyObject>>;
129    );
130}
131
132/// Methods declared on superclass `NSObject`.
133impl NSExceptionHandler {
134    extern_methods!(
135        #[unsafe(method(init))]
136        #[unsafe(method_family = init)]
137        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
138
139        #[unsafe(method(new))]
140        #[unsafe(method_family = new)]
141        pub unsafe fn new() -> Retained<Self>;
142    );
143}
144
145mod private_NSObjectNSExceptionHandlerDelegate {
146    pub trait Sealed {}
147}
148
149/// Category "NSExceptionHandlerDelegate" on [`NSObject`].
150#[doc(alias = "NSExceptionHandlerDelegate")]
151pub unsafe trait NSObjectNSExceptionHandlerDelegate:
152    ClassType + Sized + private_NSObjectNSExceptionHandlerDelegate::Sealed
153{
154    extern_methods!(
155        /// # Safety
156        ///
157        /// - `sender` might not allow `None`.
158        /// - `exception` might not allow `None`.
159        #[unsafe(method(exceptionHandler:shouldLogException:mask:))]
160        #[unsafe(method_family = none)]
161        unsafe fn exceptionHandler_shouldLogException_mask(
162            &self,
163            sender: Option<&NSExceptionHandler>,
164            exception: Option<&NSException>,
165            a_mask: NSUInteger,
166        ) -> bool;
167
168        /// # Safety
169        ///
170        /// - `sender` might not allow `None`.
171        /// - `exception` might not allow `None`.
172        #[unsafe(method(exceptionHandler:shouldHandleException:mask:))]
173        #[unsafe(method_family = none)]
174        unsafe fn exceptionHandler_shouldHandleException_mask(
175            &self,
176            sender: Option<&NSExceptionHandler>,
177            exception: Option<&NSException>,
178            a_mask: NSUInteger,
179        ) -> bool;
180    );
181}
182
183impl private_NSObjectNSExceptionHandlerDelegate::Sealed for NSObject {}
184unsafe impl NSObjectNSExceptionHandlerDelegate for NSObject {}
185
186extern "C-unwind" {
187    #[deprecated = "renamed to `NSExceptionHandler::resume`"]
188    pub fn NSExceptionHandlerResume();
189}