objc2_foundation/generated/
NSURLHandle.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern "C" {
10    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nshttppropertystatuscodekey?language=objc)
11    #[cfg(feature = "NSString")]
12    #[deprecated]
13    pub static NSHTTPPropertyStatusCodeKey: Option<&'static NSString>;
14}
15
16extern "C" {
17    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nshttppropertystatusreasonkey?language=objc)
18    #[cfg(feature = "NSString")]
19    #[deprecated]
20    pub static NSHTTPPropertyStatusReasonKey: Option<&'static NSString>;
21}
22
23extern "C" {
24    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nshttppropertyserverhttpversionkey?language=objc)
25    #[cfg(feature = "NSString")]
26    #[deprecated]
27    pub static NSHTTPPropertyServerHTTPVersionKey: Option<&'static NSString>;
28}
29
30extern "C" {
31    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nshttppropertyredirectionheaderskey?language=objc)
32    #[cfg(feature = "NSString")]
33    #[deprecated]
34    pub static NSHTTPPropertyRedirectionHeadersKey: Option<&'static NSString>;
35}
36
37extern "C" {
38    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nshttppropertyerrorpagedatakey?language=objc)
39    #[cfg(feature = "NSString")]
40    #[deprecated]
41    pub static NSHTTPPropertyErrorPageDataKey: Option<&'static NSString>;
42}
43
44extern "C" {
45    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nshttppropertyhttpproxy?language=objc)
46    #[cfg(feature = "NSString")]
47    #[deprecated]
48    pub static NSHTTPPropertyHTTPProxy: Option<&'static NSString>;
49}
50
51extern "C" {
52    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsftppropertyuserloginkey?language=objc)
53    #[cfg(feature = "NSString")]
54    #[deprecated]
55    pub static NSFTPPropertyUserLoginKey: Option<&'static NSString>;
56}
57
58extern "C" {
59    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsftppropertyuserpasswordkey?language=objc)
60    #[cfg(feature = "NSString")]
61    #[deprecated]
62    pub static NSFTPPropertyUserPasswordKey: Option<&'static NSString>;
63}
64
65extern "C" {
66    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsftppropertyactivetransfermodekey?language=objc)
67    #[cfg(feature = "NSString")]
68    #[deprecated]
69    pub static NSFTPPropertyActiveTransferModeKey: Option<&'static NSString>;
70}
71
72extern "C" {
73    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsftppropertyfileoffsetkey?language=objc)
74    #[cfg(feature = "NSString")]
75    #[deprecated]
76    pub static NSFTPPropertyFileOffsetKey: Option<&'static NSString>;
77}
78
79extern "C" {
80    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsftppropertyftpproxy?language=objc)
81    #[cfg(feature = "NSString")]
82    #[deprecated]
83    pub static NSFTPPropertyFTPProxy: Option<&'static NSString>;
84}
85
86/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlhandlestatus?language=objc)
87// NS_ENUM
88#[repr(transparent)]
89#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
90pub struct NSURLHandleStatus(pub NSUInteger);
91impl NSURLHandleStatus {
92    #[doc(alias = "NSURLHandleNotLoaded")]
93    pub const NotLoaded: Self = Self(0);
94    #[doc(alias = "NSURLHandleLoadSucceeded")]
95    pub const LoadSucceeded: Self = Self(1);
96    #[doc(alias = "NSURLHandleLoadInProgress")]
97    pub const LoadInProgress: Self = Self(2);
98    #[doc(alias = "NSURLHandleLoadFailed")]
99    pub const LoadFailed: Self = Self(3);
100}
101
102unsafe impl Encode for NSURLHandleStatus {
103    const ENCODING: Encoding = NSUInteger::ENCODING;
104}
105
106unsafe impl RefEncode for NSURLHandleStatus {
107    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
108}
109
110extern_protocol!(
111    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlhandleclient?language=objc)
112    #[deprecated]
113    pub unsafe trait NSURLHandleClient {
114        #[cfg(feature = "NSData")]
115        /// # Safety
116        ///
117        /// - `sender` might not allow `None`.
118        /// - `new_bytes` might not allow `None`.
119        #[deprecated]
120        #[unsafe(method(URLHandle:resourceDataDidBecomeAvailable:))]
121        #[unsafe(method_family = none)]
122        unsafe fn URLHandle_resourceDataDidBecomeAvailable(
123            &self,
124            sender: Option<&NSURLHandle>,
125            new_bytes: Option<&NSData>,
126        );
127
128        /// # Safety
129        ///
130        /// `sender` might not allow `None`.
131        #[deprecated]
132        #[unsafe(method(URLHandleResourceDidBeginLoading:))]
133        #[unsafe(method_family = none)]
134        unsafe fn URLHandleResourceDidBeginLoading(&self, sender: Option<&NSURLHandle>);
135
136        /// # Safety
137        ///
138        /// `sender` might not allow `None`.
139        #[deprecated]
140        #[unsafe(method(URLHandleResourceDidFinishLoading:))]
141        #[unsafe(method_family = none)]
142        unsafe fn URLHandleResourceDidFinishLoading(&self, sender: Option<&NSURLHandle>);
143
144        /// # Safety
145        ///
146        /// `sender` might not allow `None`.
147        #[deprecated]
148        #[unsafe(method(URLHandleResourceDidCancelLoading:))]
149        #[unsafe(method_family = none)]
150        unsafe fn URLHandleResourceDidCancelLoading(&self, sender: Option<&NSURLHandle>);
151
152        #[cfg(feature = "NSString")]
153        /// # Safety
154        ///
155        /// - `sender` might not allow `None`.
156        /// - `reason` might not allow `None`.
157        #[deprecated]
158        #[unsafe(method(URLHandle:resourceDidFailLoadingWithReason:))]
159        #[unsafe(method_family = none)]
160        unsafe fn URLHandle_resourceDidFailLoadingWithReason(
161            &self,
162            sender: Option<&NSURLHandle>,
163            reason: Option<&NSString>,
164        );
165    }
166);
167
168extern_class!(
169    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlhandle?language=objc)
170    #[unsafe(super(NSObject))]
171    #[derive(Debug, PartialEq, Eq, Hash)]
172    pub struct NSURLHandle;
173);
174
175extern_conformance!(
176    unsafe impl NSObjectProtocol for NSURLHandle {}
177);
178
179impl NSURLHandle {
180    extern_methods!(
181        /// # Safety
182        ///
183        /// - `an_url_handle_subclass` probably has further requirements.
184        /// - `an_url_handle_subclass` might not allow `None`.
185        #[deprecated]
186        #[unsafe(method(registerURLHandleClass:))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn registerURLHandleClass(an_url_handle_subclass: Option<&AnyClass>);
189
190        #[cfg(feature = "NSURL")]
191        /// # Safety
192        ///
193        /// `an_url` might not allow `None`.
194        #[deprecated]
195        #[unsafe(method(URLHandleClassForURL:))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn URLHandleClassForURL(an_url: Option<&NSURL>) -> Option<&'static AnyClass>;
198
199        #[deprecated]
200        #[unsafe(method(status))]
201        #[unsafe(method_family = none)]
202        pub fn status(&self) -> NSURLHandleStatus;
203
204        #[cfg(feature = "NSString")]
205        #[deprecated]
206        #[unsafe(method(failureReason))]
207        #[unsafe(method_family = none)]
208        pub fn failureReason(&self) -> Option<Retained<NSString>>;
209
210        /// # Safety
211        ///
212        /// `client` might not allow `None`.
213        #[deprecated]
214        #[unsafe(method(addClient:))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn addClient(&self, client: Option<&ProtocolObject<dyn NSURLHandleClient>>);
217
218        /// # Safety
219        ///
220        /// `client` might not allow `None`.
221        #[deprecated]
222        #[unsafe(method(removeClient:))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn removeClient(&self, client: Option<&ProtocolObject<dyn NSURLHandleClient>>);
225
226        #[deprecated]
227        #[unsafe(method(loadInBackground))]
228        #[unsafe(method_family = none)]
229        pub fn loadInBackground(&self);
230
231        #[deprecated]
232        #[unsafe(method(cancelLoadInBackground))]
233        #[unsafe(method_family = none)]
234        pub fn cancelLoadInBackground(&self);
235
236        #[cfg(feature = "NSData")]
237        #[deprecated]
238        #[unsafe(method(resourceData))]
239        #[unsafe(method_family = none)]
240        pub fn resourceData(&self) -> Option<Retained<NSData>>;
241
242        #[cfg(feature = "NSData")]
243        #[deprecated]
244        #[unsafe(method(availableResourceData))]
245        #[unsafe(method_family = none)]
246        pub fn availableResourceData(&self) -> Option<Retained<NSData>>;
247
248        #[deprecated]
249        #[unsafe(method(expectedResourceDataSize))]
250        #[unsafe(method_family = none)]
251        pub fn expectedResourceDataSize(&self) -> c_longlong;
252
253        #[deprecated]
254        #[unsafe(method(flushCachedData))]
255        #[unsafe(method_family = none)]
256        pub fn flushCachedData(&self);
257
258        #[cfg(feature = "NSString")]
259        /// # Safety
260        ///
261        /// `reason` might not allow `None`.
262        #[deprecated]
263        #[unsafe(method(backgroundLoadDidFailWithReason:))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn backgroundLoadDidFailWithReason(&self, reason: Option<&NSString>);
266
267        #[cfg(feature = "NSData")]
268        /// # Safety
269        ///
270        /// `new_bytes` might not allow `None`.
271        #[deprecated]
272        #[unsafe(method(didLoadBytes:loadComplete:))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn didLoadBytes_loadComplete(&self, new_bytes: Option<&NSData>, yorn: bool);
275
276        #[cfg(feature = "NSURL")]
277        /// # Safety
278        ///
279        /// `an_url` might not allow `None`.
280        #[deprecated]
281        #[unsafe(method(canInitWithURL:))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn canInitWithURL(an_url: Option<&NSURL>) -> bool;
284
285        #[cfg(feature = "NSURL")]
286        /// # Safety
287        ///
288        /// `an_url` might not allow `None`.
289        #[deprecated]
290        #[unsafe(method(cachedHandleForURL:))]
291        #[unsafe(method_family = none)]
292        pub unsafe fn cachedHandleForURL(an_url: Option<&NSURL>) -> Option<Retained<NSURLHandle>>;
293
294        #[cfg(feature = "NSURL")]
295        /// # Safety
296        ///
297        /// `an_url` might not allow `None`.
298        #[deprecated]
299        #[unsafe(method(initWithURL:cached:))]
300        #[unsafe(method_family = init)]
301        pub unsafe fn initWithURL_cached(
302            this: Allocated<Self>,
303            an_url: Option<&NSURL>,
304            will_cache: bool,
305        ) -> Option<Retained<Self>>;
306
307        #[cfg(feature = "NSString")]
308        /// # Safety
309        ///
310        /// `property_key` might not allow `None`.
311        #[deprecated]
312        #[unsafe(method(propertyForKey:))]
313        #[unsafe(method_family = none)]
314        pub unsafe fn propertyForKey(
315            &self,
316            property_key: Option<&NSString>,
317        ) -> Option<Retained<AnyObject>>;
318
319        #[cfg(feature = "NSString")]
320        /// # Safety
321        ///
322        /// `property_key` might not allow `None`.
323        #[deprecated]
324        #[unsafe(method(propertyForKeyIfAvailable:))]
325        #[unsafe(method_family = none)]
326        pub unsafe fn propertyForKeyIfAvailable(
327            &self,
328            property_key: Option<&NSString>,
329        ) -> Option<Retained<AnyObject>>;
330
331        #[cfg(feature = "NSString")]
332        /// # Safety
333        ///
334        /// - `property_value` should be of the correct type.
335        /// - `property_value` might not allow `None`.
336        /// - `property_key` might not allow `None`.
337        #[deprecated]
338        #[unsafe(method(writeProperty:forKey:))]
339        #[unsafe(method_family = none)]
340        pub unsafe fn writeProperty_forKey(
341            &self,
342            property_value: Option<&AnyObject>,
343            property_key: Option<&NSString>,
344        ) -> bool;
345
346        #[cfg(feature = "NSData")]
347        /// # Safety
348        ///
349        /// `data` might not allow `None`.
350        #[deprecated]
351        #[unsafe(method(writeData:))]
352        #[unsafe(method_family = none)]
353        pub unsafe fn writeData(&self, data: Option<&NSData>) -> bool;
354
355        #[cfg(feature = "NSData")]
356        #[deprecated]
357        #[unsafe(method(loadInForeground))]
358        #[unsafe(method_family = none)]
359        pub fn loadInForeground(&self) -> Option<Retained<NSData>>;
360
361        #[deprecated]
362        #[unsafe(method(beginLoadInBackground))]
363        #[unsafe(method_family = none)]
364        pub fn beginLoadInBackground(&self);
365
366        #[deprecated]
367        #[unsafe(method(endLoadInBackground))]
368        #[unsafe(method_family = none)]
369        pub fn endLoadInBackground(&self);
370    );
371}
372
373/// Methods declared on superclass `NSObject`.
374impl NSURLHandle {
375    extern_methods!(
376        #[unsafe(method(init))]
377        #[unsafe(method_family = init)]
378        pub fn init(this: Allocated<Self>) -> Retained<Self>;
379
380        #[unsafe(method(new))]
381        #[unsafe(method_family = new)]
382        pub fn new() -> Retained<Self>;
383    );
384}
385
386impl DefaultRetained for NSURLHandle {
387    #[inline]
388    fn default_retained() -> Retained<Self> {
389        Self::new()
390    }
391}