objc2_core_location/generated/
CLServiceSession.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "dispatch2")]
6use dispatch2::*;
7use objc2::__framework_prelude::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/corelocation/clservicesessionauthorizationrequirement?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct CLServiceSessionAuthorizationRequirement(pub NSInteger);
17impl CLServiceSessionAuthorizationRequirement {
18    #[doc(alias = "CLServiceSessionAuthorizationRequirementNone")]
19    pub const None: Self = Self(0);
20    #[doc(alias = "CLServiceSessionAuthorizationRequirementWhenInUse")]
21    pub const WhenInUse: Self = Self(1);
22    #[doc(alias = "CLServiceSessionAuthorizationRequirementAlways")]
23    pub const Always: Self = Self(2);
24}
25
26unsafe impl Encode for CLServiceSessionAuthorizationRequirement {
27    const ENCODING: Encoding = NSInteger::ENCODING;
28}
29
30unsafe impl RefEncode for CLServiceSessionAuthorizationRequirement {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34extern_class!(
35    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/clservicesessiondiagnostic?language=objc)
36    #[unsafe(super(NSObject))]
37    #[derive(Debug, PartialEq, Eq, Hash)]
38    pub struct CLServiceSessionDiagnostic;
39);
40
41extern_conformance!(
42    unsafe impl NSObjectProtocol for CLServiceSessionDiagnostic {}
43);
44
45impl CLServiceSessionDiagnostic {
46    extern_methods!(
47        #[unsafe(method(authorizationDenied))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn authorizationDenied(&self) -> bool;
50
51        #[unsafe(method(authorizationDeniedGlobally))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn authorizationDeniedGlobally(&self) -> bool;
54
55        #[unsafe(method(authorizationRestricted))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn authorizationRestricted(&self) -> bool;
58
59        #[unsafe(method(insufficientlyInUse))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn insufficientlyInUse(&self) -> bool;
62
63        #[unsafe(method(serviceSessionRequired))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn serviceSessionRequired(&self) -> bool;
66
67        #[unsafe(method(fullAccuracyDenied))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn fullAccuracyDenied(&self) -> bool;
70
71        #[unsafe(method(alwaysAuthorizationDenied))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn alwaysAuthorizationDenied(&self) -> bool;
74
75        #[unsafe(method(authorizationRequestInProgress))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn authorizationRequestInProgress(&self) -> bool;
78    );
79}
80
81/// Methods declared on superclass `NSObject`.
82impl CLServiceSessionDiagnostic {
83    extern_methods!(
84        #[unsafe(method(init))]
85        #[unsafe(method_family = init)]
86        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
87
88        #[unsafe(method(new))]
89        #[unsafe(method_family = new)]
90        pub unsafe fn new() -> Retained<Self>;
91    );
92}
93
94extern_class!(
95    /// [Apple's documentation](https://developer.apple.com/documentation/corelocation/clservicesession?language=objc)
96    #[unsafe(super(NSObject))]
97    #[derive(Debug, PartialEq, Eq, Hash)]
98    pub struct CLServiceSession;
99);
100
101extern_conformance!(
102    unsafe impl NSObjectProtocol for CLServiceSession {}
103);
104
105impl CLServiceSession {
106    extern_methods!(
107        #[unsafe(method(init))]
108        #[unsafe(method_family = init)]
109        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
110
111        #[unsafe(method(new))]
112        #[unsafe(method_family = new)]
113        pub unsafe fn new() -> Retained<Self>;
114
115        #[unsafe(method(sessionRequiringAuthorization:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn sessionRequiringAuthorization(
118            authorization_requirement: CLServiceSessionAuthorizationRequirement,
119        ) -> Retained<CLServiceSession>;
120
121        #[cfg(all(feature = "block2", feature = "dispatch2"))]
122        /// # Safety
123        ///
124        /// `queue` possibly has additional threading requirements.
125        #[unsafe(method(sessionRequiringAuthorization:queue:handler:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn sessionRequiringAuthorization_queue_handler(
128            authorization_requirement: CLServiceSessionAuthorizationRequirement,
129            queue: &DispatchQueue,
130            handler: &block2::DynBlock<dyn Fn(NonNull<CLServiceSessionDiagnostic>)>,
131        ) -> Retained<CLServiceSession>;
132
133        #[unsafe(method(sessionRequiringAuthorization:fullAccuracyPurposeKey:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn sessionRequiringAuthorization_fullAccuracyPurposeKey(
136            authorization_requirement: CLServiceSessionAuthorizationRequirement,
137            purpose_key: &NSString,
138        ) -> Retained<CLServiceSession>;
139
140        #[cfg(all(feature = "block2", feature = "dispatch2"))]
141        /// # Safety
142        ///
143        /// `queue` possibly has additional threading requirements.
144        #[unsafe(method(sessionRequiringAuthorization:fullAccuracyPurposeKey:queue:handler:))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn sessionRequiringAuthorization_fullAccuracyPurposeKey_queue_handler(
147            authorization_requirement: CLServiceSessionAuthorizationRequirement,
148            purpose_key: &NSString,
149            queue: &DispatchQueue,
150            handler: &block2::DynBlock<dyn Fn(NonNull<CLServiceSessionDiagnostic>)>,
151        ) -> Retained<CLServiceSession>;
152
153        #[unsafe(method(invalidate))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn invalidate(&self);
156    );
157}