objc2_av_foundation/generated/
AVAssetDownloadStorageManager.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// AVAssetDownloadedAssetEvictionPriority string constants
11///
12/// Used by AVAssetDownloadStorageManagementPolicy.
13///
14/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetdownloadedassetevictionpriority?language=objc)
15// NS_TYPED_ENUM
16pub type AVAssetDownloadedAssetEvictionPriority = NSString;
17
18extern "C" {
19    /// These constants represents the eviction priority of downloaded assets.
20    ///
21    ///
22    /// Used to mark assets with the highest priority. They will be the last to be purged.
23    ///
24    /// Used to mark assets have the default priority. They will be the first to be purged.
25    ///
26    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetdownloadedassetevictionpriorityimportant?language=objc)
27    pub static AVAssetDownloadedAssetEvictionPriorityImportant:
28        &'static AVAssetDownloadedAssetEvictionPriority;
29}
30
31extern "C" {
32    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetdownloadedassetevictionprioritydefault?language=objc)
33    pub static AVAssetDownloadedAssetEvictionPriorityDefault:
34        &'static AVAssetDownloadedAssetEvictionPriority;
35}
36
37extern_class!(
38    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetdownloadstoragemanager?language=objc)
39    #[unsafe(super(NSObject))]
40    #[derive(Debug, PartialEq, Eq, Hash)]
41    pub struct AVAssetDownloadStorageManager;
42);
43
44unsafe impl NSObjectProtocol for AVAssetDownloadStorageManager {}
45
46impl AVAssetDownloadStorageManager {
47    extern_methods!(
48        /// returns singleton instance.
49        #[unsafe(method(sharedDownloadStorageManager))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn sharedDownloadStorageManager() -> Retained<AVAssetDownloadStorageManager>;
52
53        /// Sets the policy for asset with disk backing at downloadStorageURL.
54        ///
55        /// Parameter `downloadStorageURL`: The location of downloaded asset.
56        #[unsafe(method(setStorageManagementPolicy:forURL:))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn setStorageManagementPolicy_forURL(
59            &self,
60            storage_management_policy: &AVAssetDownloadStorageManagementPolicy,
61            download_storage_url: &NSURL,
62        );
63
64        /// Returns the storage management policy for asset downloaded at downloadStorageURL.
65        /// This may be nil if a storageManagementPolicy was never set on the downloaded asset.
66        ///
67        /// Parameter `downloadStorageURL`: The location of downloaded asset.
68        #[unsafe(method(storageManagementPolicyForURL:))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn storageManagementPolicyForURL(
71            &self,
72            download_storage_url: &NSURL,
73        ) -> Option<Retained<AVAssetDownloadStorageManagementPolicy>>;
74    );
75}
76
77/// Methods declared on superclass `NSObject`.
78impl AVAssetDownloadStorageManager {
79    extern_methods!(
80        #[unsafe(method(init))]
81        #[unsafe(method_family = init)]
82        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
83
84        #[unsafe(method(new))]
85        #[unsafe(method_family = new)]
86        pub unsafe fn new() -> Retained<Self>;
87    );
88}
89
90extern_class!(
91    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avassetdownloadstoragemanagementpolicy?language=objc)
92    #[unsafe(super(NSObject))]
93    #[derive(Debug, PartialEq, Eq, Hash)]
94    pub struct AVAssetDownloadStorageManagementPolicy;
95);
96
97unsafe impl NSCopying for AVAssetDownloadStorageManagementPolicy {}
98
99unsafe impl CopyingHelper for AVAssetDownloadStorageManagementPolicy {
100    type Result = Self;
101}
102
103unsafe impl NSMutableCopying for AVAssetDownloadStorageManagementPolicy {}
104
105unsafe impl MutableCopyingHelper for AVAssetDownloadStorageManagementPolicy {
106    type Result = AVMutableAssetDownloadStorageManagementPolicy;
107}
108
109unsafe impl NSObjectProtocol for AVAssetDownloadStorageManagementPolicy {}
110
111impl AVAssetDownloadStorageManagementPolicy {
112    extern_methods!(
113        #[unsafe(method(priority))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn priority(&self) -> Retained<AVAssetDownloadedAssetEvictionPriority>;
116
117        #[unsafe(method(expirationDate))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn expirationDate(&self) -> Retained<NSDate>;
120    );
121}
122
123/// Methods declared on superclass `NSObject`.
124impl AVAssetDownloadStorageManagementPolicy {
125    extern_methods!(
126        #[unsafe(method(init))]
127        #[unsafe(method_family = init)]
128        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
129
130        #[unsafe(method(new))]
131        #[unsafe(method_family = new)]
132        pub unsafe fn new() -> Retained<Self>;
133    );
134}
135
136extern_class!(
137    /// A mutable subclass of AVAssetDownloadStorageManagementPolicy.
138    ///
139    ///
140    /// System will put in best-effort to evict all the assets based on expirationDate before evicting based on priority.
141    ///
142    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avmutableassetdownloadstoragemanagementpolicy?language=objc)
143    #[unsafe(super(AVAssetDownloadStorageManagementPolicy, NSObject))]
144    #[derive(Debug, PartialEq, Eq, Hash)]
145    pub struct AVMutableAssetDownloadStorageManagementPolicy;
146);
147
148unsafe impl NSCopying for AVMutableAssetDownloadStorageManagementPolicy {}
149
150unsafe impl CopyingHelper for AVMutableAssetDownloadStorageManagementPolicy {
151    type Result = AVAssetDownloadStorageManagementPolicy;
152}
153
154unsafe impl NSMutableCopying for AVMutableAssetDownloadStorageManagementPolicy {}
155
156unsafe impl MutableCopyingHelper for AVMutableAssetDownloadStorageManagementPolicy {
157    type Result = Self;
158}
159
160unsafe impl NSObjectProtocol for AVMutableAssetDownloadStorageManagementPolicy {}
161
162impl AVMutableAssetDownloadStorageManagementPolicy {
163    extern_methods!(
164        #[unsafe(method(priority))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn priority(&self) -> Retained<AVAssetDownloadedAssetEvictionPriority>;
167
168        /// Setter for [`priority`][Self::priority].
169        #[unsafe(method(setPriority:))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn setPriority(&self, priority: &AVAssetDownloadedAssetEvictionPriority);
172
173        #[unsafe(method(expirationDate))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn expirationDate(&self) -> Retained<NSDate>;
176
177        /// Setter for [`expirationDate`][Self::expirationDate].
178        #[unsafe(method(setExpirationDate:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn setExpirationDate(&self, expiration_date: &NSDate);
181    );
182}
183
184/// Methods declared on superclass `NSObject`.
185impl AVMutableAssetDownloadStorageManagementPolicy {
186    extern_methods!(
187        #[unsafe(method(init))]
188        #[unsafe(method_family = init)]
189        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
190
191        #[unsafe(method(new))]
192        #[unsafe(method_family = new)]
193        pub unsafe fn new() -> Retained<Self>;
194    );
195}