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:))]
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
128impl 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#[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}