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