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