objc2_metric_kit/generated/MXAppExitMetric.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10 /// A class that encapsulates cumulative application exit metrics when the application is on screen.
11 ///
12 /// Foreground exits are user visible terminations that, when unexpected, interrupt usage.
13 ///
14 /// Not all foreground exits are unexpected. See the documentation for each exit reason for more information.
15 ///
16 /// See also [Apple's documentation](https://developer.apple.com/documentation/metrickit/mxforegroundexitdata?language=objc)
17 #[unsafe(super(NSObject))]
18 #[derive(Debug, PartialEq, Eq, Hash)]
19 pub struct MXForegroundExitData;
20);
21
22extern_conformance!(
23 unsafe impl NSCoding for MXForegroundExitData {}
24);
25
26extern_conformance!(
27 unsafe impl NSObjectProtocol for MXForegroundExitData {}
28);
29
30extern_conformance!(
31 unsafe impl NSSecureCoding for MXForegroundExitData {}
32);
33
34impl MXForegroundExitData {
35 extern_methods!(
36 /// Cumulative number of times the application exited normally, or was gracefully terminated by the system.
37 #[unsafe(method(cumulativeNormalAppExitCount))]
38 #[unsafe(method_family = none)]
39 pub unsafe fn cumulativeNormalAppExitCount(&self) -> NSUInteger;
40
41 /// Cumulative number of times the application was terminated for exceeding a memory consumption limit.
42 #[unsafe(method(cumulativeMemoryResourceLimitExitCount))]
43 #[unsafe(method_family = none)]
44 pub unsafe fn cumulativeMemoryResourceLimitExitCount(&self) -> NSUInteger;
45
46 /// Cumulative number of times the application was terminated for attempting to access invalid memory, or attempting to access memory in a manner not allowed by the memory's protection level (e.g. writing to read-only memory).
47 #[unsafe(method(cumulativeBadAccessExitCount))]
48 #[unsafe(method_family = none)]
49 pub unsafe fn cumulativeBadAccessExitCount(&self) -> NSUInteger;
50
51 /// Cumulative number of times the application exited abnormally.
52 ///
53 /// The most common causes of crashes with this exception type are uncaught Objective-C/C++ exceptions and calls to abort().
54 #[unsafe(method(cumulativeAbnormalExitCount))]
55 #[unsafe(method_family = none)]
56 pub unsafe fn cumulativeAbnormalExitCount(&self) -> NSUInteger;
57
58 /// Cumulative number of times the application terminated for attempting to execute an illegal or undefined instruction.
59 ///
60 /// The process may have attempted to jump to an invalid address via a misconfigured function pointer.
61 #[unsafe(method(cumulativeIllegalInstructionExitCount))]
62 #[unsafe(method_family = none)]
63 pub unsafe fn cumulativeIllegalInstructionExitCount(&self) -> NSUInteger;
64
65 /// Cumulative number of times the application was terminated because a watchdog timeout occured.
66 ///
67 /// These can occur when the application took too long to launch, terminate, or respond to system events.
68 #[unsafe(method(cumulativeAppWatchdogExitCount))]
69 #[unsafe(method_family = none)]
70 pub unsafe fn cumulativeAppWatchdogExitCount(&self) -> NSUInteger;
71 );
72}
73
74/// Methods declared on superclass `NSObject`.
75impl MXForegroundExitData {
76 extern_methods!(
77 #[unsafe(method(init))]
78 #[unsafe(method_family = init)]
79 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
80
81 #[unsafe(method(new))]
82 #[unsafe(method_family = new)]
83 pub unsafe fn new() -> Retained<Self>;
84 );
85}
86
87extern_class!(
88 /// A class that encapsulates cumulative application exit metrics when the application is off screen.
89 ///
90 /// Background exits are terminations that, when unexpected, can impact performance metrics, such as launch time.
91 ///
92 /// Not all background exits are unexpected. See the documentation for each exit reason for more information.
93 ///
94 /// See also [Apple's documentation](https://developer.apple.com/documentation/metrickit/mxbackgroundexitdata?language=objc)
95 #[unsafe(super(NSObject))]
96 #[derive(Debug, PartialEq, Eq, Hash)]
97 pub struct MXBackgroundExitData;
98);
99
100extern_conformance!(
101 unsafe impl NSCoding for MXBackgroundExitData {}
102);
103
104extern_conformance!(
105 unsafe impl NSObjectProtocol for MXBackgroundExitData {}
106);
107
108extern_conformance!(
109 unsafe impl NSSecureCoding for MXBackgroundExitData {}
110);
111
112impl MXBackgroundExitData {
113 extern_methods!(
114 /// Cumulative number of times the application exited normally, or was gracefully terminated by the system.
115 #[unsafe(method(cumulativeNormalAppExitCount))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn cumulativeNormalAppExitCount(&self) -> NSUInteger;
118
119 /// Cumulative number of times the application was terminated for exceeding a memory consumption limit.
120 #[unsafe(method(cumulativeMemoryResourceLimitExitCount))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn cumulativeMemoryResourceLimitExitCount(&self) -> NSUInteger;
123
124 /// Cumulative number of times the application was terminated for exceeding a CPU consumption limit.
125 #[unsafe(method(cumulativeCPUResourceLimitExitCount))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn cumulativeCPUResourceLimitExitCount(&self) -> NSUInteger;
128
129 /// Cumulative number of times the application exited due to memory pressure on the system.
130 #[unsafe(method(cumulativeMemoryPressureExitCount))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn cumulativeMemoryPressureExitCount(&self) -> NSUInteger;
133
134 /// Cumulative number of times the application was terminated for attempting to access invalid memory, or attempting to access memory in a manner not allowed by the memory's protection level (e.g. writing to read-only memory).
135 #[unsafe(method(cumulativeBadAccessExitCount))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn cumulativeBadAccessExitCount(&self) -> NSUInteger;
138
139 /// Cumulative number of times the application exited abnormally.
140 ///
141 /// The most common causes of crashes with this exception type are uncaught Objective-C/C++ exceptions and calls to abort().
142 #[unsafe(method(cumulativeAbnormalExitCount))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn cumulativeAbnormalExitCount(&self) -> NSUInteger;
145
146 /// Cumulative number of times the application terminated for attempting to execute an illegal or undefined instruction.
147 ///
148 /// The process may have attempted to jump to an invalid address via a misconfigured function pointer.
149 #[unsafe(method(cumulativeIllegalInstructionExitCount))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn cumulativeIllegalInstructionExitCount(&self) -> NSUInteger;
152
153 /// Cumulative number of times the application was terminated because a watchdog timeout occured.
154 ///
155 /// These can occur when the application took too long to launch, terminate, or respond to system events.
156 #[unsafe(method(cumulativeAppWatchdogExitCount))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn cumulativeAppWatchdogExitCount(&self) -> NSUInteger;
159
160 /// Cumulative number of times the application was terminated because it became suspended while holding onto file locks or sqlite database locks.
161 ///
162 /// If your application is performing operations on a locked file or sqlite database at suspension time, it must request additional background execution time to complete those operations and relinquish the lock before suspending.
163 #[unsafe(method(cumulativeSuspendedWithLockedFileExitCount))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn cumulativeSuspendedWithLockedFileExitCount(&self) -> NSUInteger;
166
167 /// Cumulative number of times the application was terminated for exceeding the alotted time limit associated with a background tasks.
168 ///
169 /// If your application begins a background task, you must call endBackgroundTask() to signal completion of the task to prevent your application from being terminated. You can do this in the expiration handler of the task, but it must be done immediately.
170 #[unsafe(method(cumulativeBackgroundTaskAssertionTimeoutExitCount))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn cumulativeBackgroundTaskAssertionTimeoutExitCount(&self) -> NSUInteger;
173 );
174}
175
176/// Methods declared on superclass `NSObject`.
177impl MXBackgroundExitData {
178 extern_methods!(
179 #[unsafe(method(init))]
180 #[unsafe(method_family = init)]
181 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
182
183 #[unsafe(method(new))]
184 #[unsafe(method_family = new)]
185 pub unsafe fn new() -> Retained<Self>;
186 );
187}
188
189extern_class!(
190 /// A class that encapsulates application exit metrics for both on screen and off screen exits.
191 ///
192 /// Application exits can be expected, such as when the application is killed in the app switcher by the user, or unexpected, such as when a runtime error occurs.
193 ///
194 /// Minimizing unexpected exits and maximizing expected exits can improve performance and reliability of your application.
195 ///
196 /// See also [Apple's documentation](https://developer.apple.com/documentation/metrickit/mxappexitmetric?language=objc)
197 #[unsafe(super(MXMetric, NSObject))]
198 #[derive(Debug, PartialEq, Eq, Hash)]
199 #[cfg(feature = "MXMetric")]
200 pub struct MXAppExitMetric;
201);
202
203#[cfg(feature = "MXMetric")]
204extern_conformance!(
205 unsafe impl NSCoding for MXAppExitMetric {}
206);
207
208#[cfg(feature = "MXMetric")]
209extern_conformance!(
210 unsafe impl NSObjectProtocol for MXAppExitMetric {}
211);
212
213#[cfg(feature = "MXMetric")]
214extern_conformance!(
215 unsafe impl NSSecureCoding for MXAppExitMetric {}
216);
217
218#[cfg(feature = "MXMetric")]
219impl MXAppExitMetric {
220 extern_methods!(
221 /// Cumulative foreground exit data.
222 ///
223 /// This includes application exit data when the application was on screen and visible to the user.
224 #[unsafe(method(foregroundExitData))]
225 #[unsafe(method_family = none)]
226 pub unsafe fn foregroundExitData(&self) -> Retained<MXForegroundExitData>;
227
228 /// Cumulative background exit data.
229 ///
230 /// This includes application exit data when the application was off screen and not visible to the user.
231 #[unsafe(method(backgroundExitData))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn backgroundExitData(&self) -> Retained<MXBackgroundExitData>;
234 );
235}
236
237/// Methods declared on superclass `NSObject`.
238#[cfg(feature = "MXMetric")]
239impl MXAppExitMetric {
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}