objc2_photos/generated/
PHAsset.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#[cfg(feature = "objc2-uniform-type-identifiers")]
9use objc2_uniform_type_identifiers::*;
10
11use crate::*;
12
13extern_class!(
14    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phasset?language=objc)
15    #[unsafe(super(PHObject, NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    #[cfg(feature = "PHObject")]
18    pub struct PHAsset;
19);
20
21#[cfg(feature = "PHObject")]
22unsafe impl Send for PHAsset {}
23
24#[cfg(feature = "PHObject")]
25unsafe impl Sync for PHAsset {}
26
27#[cfg(feature = "PHObject")]
28extern_conformance!(
29    unsafe impl NSCopying for PHAsset {}
30);
31
32#[cfg(feature = "PHObject")]
33unsafe impl CopyingHelper for PHAsset {
34    type Result = Self;
35}
36
37#[cfg(feature = "PHObject")]
38extern_conformance!(
39    unsafe impl NSObjectProtocol for PHAsset {}
40);
41
42#[cfg(feature = "PHObject")]
43impl PHAsset {
44    extern_methods!(
45        #[cfg(feature = "PhotosTypes")]
46        /// This property is not atomic.
47        ///
48        /// # Safety
49        ///
50        /// This might not be thread-safe.
51        #[unsafe(method(playbackStyle))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn playbackStyle(&self) -> PHAssetPlaybackStyle;
54
55        #[cfg(feature = "PhotosTypes")]
56        /// This property is not atomic.
57        ///
58        /// # Safety
59        ///
60        /// This might not be thread-safe.
61        #[unsafe(method(mediaType))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn mediaType(&self) -> PHAssetMediaType;
64
65        #[cfg(feature = "PhotosTypes")]
66        /// This property is not atomic.
67        ///
68        /// # Safety
69        ///
70        /// This might not be thread-safe.
71        #[unsafe(method(mediaSubtypes))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn mediaSubtypes(&self) -> PHAssetMediaSubtype;
74
75        #[cfg(feature = "objc2-uniform-type-identifiers")]
76        /// The type of image or video data that is presented for the asset
77        ///
78        /// This property is not atomic.
79        ///
80        /// # Safety
81        ///
82        /// This might not be thread-safe.
83        #[unsafe(method(contentType))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn contentType(&self) -> Retained<UTType>;
86
87        /// This property is not atomic.
88        ///
89        /// # Safety
90        ///
91        /// This might not be thread-safe.
92        #[unsafe(method(pixelWidth))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn pixelWidth(&self) -> NSUInteger;
95
96        /// This property is not atomic.
97        ///
98        /// # Safety
99        ///
100        /// This might not be thread-safe.
101        #[unsafe(method(pixelHeight))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn pixelHeight(&self) -> NSUInteger;
104
105        /// The date and time of this asset's creation (can be updated by the user)
106        ///
107        /// This property is not atomic.
108        ///
109        /// # Safety
110        ///
111        /// This might not be thread-safe.
112        #[unsafe(method(creationDate))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn creationDate(&self) -> Option<Retained<NSDate>>;
115
116        /// The date and time of the last modification to this asset or one of its properties
117        ///
118        /// This property is not atomic.
119        ///
120        /// # Safety
121        ///
122        /// This might not be thread-safe.
123        #[unsafe(method(modificationDate))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn modificationDate(&self) -> Option<Retained<NSDate>>;
126
127        /// The date and time this asset was added to the photo library (from the device that was used to add this asset)
128        ///
129        /// This property is not atomic.
130        ///
131        /// # Safety
132        ///
133        /// This might not be thread-safe.
134        #[unsafe(method(addedDate))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn addedDate(&self) -> Retained<NSDate>;
137
138        #[cfg(feature = "objc2-core-location")]
139        /// This property is not atomic.
140        ///
141        /// # Safety
142        ///
143        /// This might not be thread-safe.
144        #[unsafe(method(location))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn location(&self) -> Option<Retained<CLLocation>>;
147
148        /// This property is not atomic.
149        ///
150        /// # Safety
151        ///
152        /// This might not be thread-safe.
153        #[unsafe(method(duration))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn duration(&self) -> NSTimeInterval;
156
157        /// This property is not atomic.
158        ///
159        /// # Safety
160        ///
161        /// This might not be thread-safe.
162        #[unsafe(method(isHidden))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn isHidden(&self) -> bool;
165
166        /// This property is not atomic.
167        ///
168        /// # Safety
169        ///
170        /// This might not be thread-safe.
171        #[unsafe(method(isFavorite))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn isFavorite(&self) -> bool;
174
175        /// This property is not atomic.
176        ///
177        /// # Safety
178        ///
179        /// This might not be thread-safe.
180        #[deprecated = "No longer supported"]
181        #[unsafe(method(isSyncFailureHidden))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn isSyncFailureHidden(&self) -> bool;
184
185        /// This property is not atomic.
186        ///
187        /// # Safety
188        ///
189        /// This might not be thread-safe.
190        #[unsafe(method(burstIdentifier))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn burstIdentifier(&self) -> Option<Retained<NSString>>;
193
194        #[cfg(feature = "PhotosTypes")]
195        /// This property is not atomic.
196        ///
197        /// # Safety
198        ///
199        /// This might not be thread-safe.
200        #[unsafe(method(burstSelectionTypes))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn burstSelectionTypes(&self) -> PHAssetBurstSelectionType;
203
204        /// This property is not atomic.
205        ///
206        /// # Safety
207        ///
208        /// This might not be thread-safe.
209        #[unsafe(method(representsBurst))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn representsBurst(&self) -> bool;
212
213        #[cfg(feature = "PhotosTypes")]
214        /// This property is not atomic.
215        ///
216        /// # Safety
217        ///
218        /// This might not be thread-safe.
219        #[unsafe(method(sourceType))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn sourceType(&self) -> PHAssetSourceType;
222
223        /// This property is not atomic.
224        ///
225        /// # Safety
226        ///
227        /// This might not be thread-safe.
228        #[unsafe(method(hasAdjustments))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn hasAdjustments(&self) -> bool;
231
232        /// This property is not atomic.
233        ///
234        /// # Safety
235        ///
236        /// This might not be thread-safe.
237        #[unsafe(method(adjustmentFormatIdentifier))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn adjustmentFormatIdentifier(&self) -> Option<Retained<NSString>>;
240
241        #[cfg(feature = "PhotosTypes")]
242        #[unsafe(method(canPerformEditOperation:))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn canPerformEditOperation(&self, edit_operation: PHAssetEditOperation) -> bool;
245
246        #[cfg(all(
247            feature = "PHCollection",
248            feature = "PHFetchOptions",
249            feature = "PHFetchResult"
250        ))]
251        #[unsafe(method(fetchAssetsInAssetCollection:options:))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn fetchAssetsInAssetCollection_options(
254            asset_collection: &PHAssetCollection,
255            options: Option<&PHFetchOptions>,
256        ) -> Retained<PHFetchResult<PHAsset>>;
257
258        #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
259        #[unsafe(method(fetchAssetsWithLocalIdentifiers:options:))]
260        #[unsafe(method_family = none)]
261        pub unsafe fn fetchAssetsWithLocalIdentifiers_options(
262            identifiers: &NSArray<NSString>,
263            options: Option<&PHFetchOptions>,
264        ) -> Retained<PHFetchResult<PHAsset>>;
265
266        #[cfg(all(
267            feature = "PHCollection",
268            feature = "PHFetchOptions",
269            feature = "PHFetchResult"
270        ))]
271        #[unsafe(method(fetchKeyAssetsInAssetCollection:options:))]
272        #[unsafe(method_family = none)]
273        pub unsafe fn fetchKeyAssetsInAssetCollection_options(
274            asset_collection: &PHAssetCollection,
275            options: Option<&PHFetchOptions>,
276        ) -> Option<Retained<PHFetchResult<PHAsset>>>;
277
278        #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
279        #[unsafe(method(fetchAssetsWithBurstIdentifier:options:))]
280        #[unsafe(method_family = none)]
281        pub unsafe fn fetchAssetsWithBurstIdentifier_options(
282            burst_identifier: &NSString,
283            options: Option<&PHFetchOptions>,
284        ) -> Retained<PHFetchResult<PHAsset>>;
285
286        #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
287        #[unsafe(method(fetchAssetsWithOptions:))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn fetchAssetsWithOptions(
290            options: Option<&PHFetchOptions>,
291        ) -> Retained<PHFetchResult<PHAsset>>;
292
293        #[cfg(all(
294            feature = "PHFetchOptions",
295            feature = "PHFetchResult",
296            feature = "PhotosTypes"
297        ))]
298        #[unsafe(method(fetchAssetsWithMediaType:options:))]
299        #[unsafe(method_family = none)]
300        pub unsafe fn fetchAssetsWithMediaType_options(
301            media_type: PHAssetMediaType,
302            options: Option<&PHFetchOptions>,
303        ) -> Retained<PHFetchResult<PHAsset>>;
304
305        #[cfg(all(feature = "PHFetchOptions", feature = "PHFetchResult"))]
306        #[deprecated = "Will be removed in a future release"]
307        #[unsafe(method(fetchAssetsWithALAssetURLs:options:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn fetchAssetsWithALAssetURLs_options(
310            asset_ur_ls: &NSArray<NSURL>,
311            options: Option<&PHFetchOptions>,
312        ) -> Retained<PHFetchResult<PHAsset>>;
313    );
314}
315
316/// Methods declared on superclass `NSObject`.
317#[cfg(feature = "PHObject")]
318impl PHAsset {
319    extern_methods!(
320        #[unsafe(method(init))]
321        #[unsafe(method_family = init)]
322        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
323
324        #[unsafe(method(new))]
325        #[unsafe(method_family = new)]
326        pub unsafe fn new() -> Retained<Self>;
327    );
328}