objc2_safety_kit/generated/
SACrashDetectionEvent.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::*;
5#[cfg(feature = "objc2-core-location")]
6use objc2_core_location::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11/// This enumeration defines possible emergency responses to a crash event
12///
13/// See also: SACrashDetectionEventResponse
14///
15/// See also [Apple's documentation](https://developer.apple.com/documentation/safetykit/sacrashdetectioneventresponse?language=objc)
16// NS_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct SACrashDetectionEventResponse(pub NSInteger);
20impl SACrashDetectionEventResponse {
21    /// Emergency SOS response for the crash event was attempted
22    #[doc(alias = "SACrashDetectionEventResponseAttempted")]
23    pub const Attempted: Self = Self(0);
24    /// Emergency SOS response for crash events is disabled
25    #[doc(alias = "SACrashDetectionEventResponseDisabled")]
26    pub const Disabled: Self = Self(1);
27}
28
29unsafe impl Encode for SACrashDetectionEventResponse {
30    const ENCODING: Encoding = NSInteger::ENCODING;
31}
32
33unsafe impl RefEncode for SACrashDetectionEventResponse {
34    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37extern_class!(
38    /// This object describes a Crash Detection event and response to it.
39    ///
40    /// See also: SACrashDetectionEvent
41    ///
42    /// See also [Apple's documentation](https://developer.apple.com/documentation/safetykit/sacrashdetectionevent?language=objc)
43    #[unsafe(super(NSObject))]
44    #[derive(Debug, PartialEq, Eq, Hash)]
45    pub struct SACrashDetectionEvent;
46);
47
48extern_conformance!(
49    unsafe impl NSCoding for SACrashDetectionEvent {}
50);
51
52extern_conformance!(
53    unsafe impl NSCopying for SACrashDetectionEvent {}
54);
55
56unsafe impl CopyingHelper for SACrashDetectionEvent {
57    type Result = Self;
58}
59
60extern_conformance!(
61    unsafe impl NSObjectProtocol for SACrashDetectionEvent {}
62);
63
64extern_conformance!(
65    unsafe impl NSSecureCoding for SACrashDetectionEvent {}
66);
67
68impl SACrashDetectionEvent {
69    extern_methods!(
70        #[unsafe(method(new))]
71        #[unsafe(method_family = new)]
72        pub unsafe fn new() -> Retained<Self>;
73
74        #[unsafe(method(init))]
75        #[unsafe(method_family = init)]
76        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
77
78        /// date
79        ///
80        ///
81        /// The time a crash was detected
82        #[unsafe(method(date))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn date(&self) -> Retained<NSDate>;
85
86        /// response
87        ///
88        ///
89        /// enum value representing the emergency response to the Crash Detection event
90        ///
91        ///
92        /// See also: SACrashDetectionEventResponse
93        #[unsafe(method(response))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn response(&self) -> SACrashDetectionEventResponse;
96
97        #[cfg(feature = "objc2-core-location")]
98        /// location
99        ///
100        ///
101        /// Location information describing the geographical location of where the Crash Detection occurred.
102        ///
103        ///
104        /// See also: CLLocation
105        #[unsafe(method(location))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn location(&self) -> Option<Retained<CLLocation>>;
108    );
109}