objc2_exception_handling/generated/
NSExceptionHandler.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10pub const NSLogAndHandleEveryExceptionMask: c_uint = NSLogUncaughtExceptionMask
12 | NSLogUncaughtSystemExceptionMask
13 | NSLogUncaughtRuntimeErrorMask
14 | NSHandleUncaughtExceptionMask
15 | NSHandleUncaughtSystemExceptionMask
16 | NSHandleUncaughtRuntimeErrorMask
17 | NSLogTopLevelExceptionMask
18 | NSHandleTopLevelExceptionMask
19 | NSLogOtherExceptionMask
20 | NSHandleOtherExceptionMask;
21pub const NSHangOnEveryExceptionMask: c_uint = NSHangOnUncaughtExceptionMask
23 | NSHangOnUncaughtSystemExceptionMask
24 | NSHangOnUncaughtRuntimeErrorMask
25 | NSHangOnTopLevelExceptionMask
26 | NSHangOnOtherExceptionMask;
27extern "C" {
28 pub static NSUncaughtSystemExceptionException: Option<&'static NSString>;
30}
31
32extern "C" {
33 pub static NSUncaughtRuntimeErrorException: Option<&'static NSString>;
35}
36
37extern "C" {
38 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
53pub const NSLogUncaughtExceptionMask: c_uint = 1 << 0;
55pub const NSHandleUncaughtExceptionMask: c_uint = 1 << 1;
57pub const NSLogUncaughtSystemExceptionMask: c_uint = 1 << 2;
59pub const NSHandleUncaughtSystemExceptionMask: c_uint = 1 << 3;
61pub const NSLogUncaughtRuntimeErrorMask: c_uint = 1 << 4;
63pub const NSHandleUncaughtRuntimeErrorMask: c_uint = 1 << 5;
65pub const NSLogTopLevelExceptionMask: c_uint = 1 << 6;
67pub const NSHandleTopLevelExceptionMask: c_uint = 1 << 7;
69pub const NSLogOtherExceptionMask: c_uint = 1 << 8;
71pub const NSHandleOtherExceptionMask: c_uint = 1 << 9;
73
74pub const NSHangOnUncaughtExceptionMask: c_uint = 1 << 0;
76pub const NSHangOnUncaughtSystemExceptionMask: c_uint = 1 << 1;
78pub const NSHangOnUncaughtRuntimeErrorMask: c_uint = 1 << 2;
80pub const NSHangOnTopLevelExceptionMask: c_uint = 1 << 3;
82pub const NSHangOnOtherExceptionMask: c_uint = 1 << 4;
84
85extern_class!(
86 #[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:))]
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
132impl 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#[doc(alias = "NSExceptionHandlerDelegate")]
151pub unsafe trait NSObjectNSExceptionHandlerDelegate:
152 ClassType + Sized + private_NSObjectNSExceptionHandlerDelegate::Sealed
153{
154 extern_methods!(
155 #[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 #[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}