objc2_photos/generated/
PHFetchResult.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
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phfetchresult?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct PHFetchResult<ObjectType: ?Sized = AnyObject>;
15);
16
17impl<ObjectType: ?Sized + Message> PHFetchResult<ObjectType> {
18    /// Unchecked conversion of the generic parameter.
19    ///
20    /// # Safety
21    ///
22    /// The generic must be valid to reinterpret as the given type.
23    #[inline]
24    pub unsafe fn cast_unchecked<NewObjectType: ?Sized + Message>(
25        &self,
26    ) -> &PHFetchResult<NewObjectType> {
27        unsafe { &*((self as *const Self).cast()) }
28    }
29}
30
31extern_conformance!(
32    unsafe impl<ObjectType: ?Sized> NSCopying for PHFetchResult<ObjectType> {}
33);
34
35unsafe impl<ObjectType: ?Sized + Message> CopyingHelper for PHFetchResult<ObjectType> {
36    type Result = Self;
37}
38
39extern_conformance!(
40    unsafe impl<ObjectType: ?Sized> NSFastEnumeration for PHFetchResult<ObjectType> {}
41);
42
43extern_conformance!(
44    unsafe impl<ObjectType: ?Sized> NSObjectProtocol for PHFetchResult<ObjectType> {}
45);
46
47impl<ObjectType: Message> PHFetchResult<ObjectType> {
48    extern_methods!(
49        #[unsafe(method(count))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn count(&self) -> NSUInteger;
52
53        #[unsafe(method(objectAtIndex:))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn objectAtIndex(&self, index: NSUInteger) -> Retained<ObjectType>;
56
57        #[unsafe(method(objectAtIndexedSubscript:))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn objectAtIndexedSubscript(&self, idx: NSUInteger) -> Retained<ObjectType>;
60
61        #[unsafe(method(containsObject:))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn containsObject(&self, an_object: &ObjectType) -> bool;
64
65        #[unsafe(method(indexOfObject:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn indexOfObject(&self, an_object: &ObjectType) -> NSUInteger;
68
69        #[unsafe(method(indexOfObject:inRange:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn indexOfObject_inRange(
72            &self,
73            an_object: &ObjectType,
74            range: NSRange,
75        ) -> NSUInteger;
76
77        /// This property is not atomic.
78        ///
79        /// # Safety
80        ///
81        /// This might not be thread-safe.
82        #[unsafe(method(firstObject))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn firstObject(&self) -> Option<Retained<ObjectType>>;
85
86        /// This property is not atomic.
87        ///
88        /// # Safety
89        ///
90        /// This might not be thread-safe.
91        #[unsafe(method(lastObject))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn lastObject(&self) -> Option<Retained<ObjectType>>;
94
95        #[unsafe(method(objectsAtIndexes:))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn objectsAtIndexes(
98            &self,
99            indexes: &NSIndexSet,
100        ) -> Retained<NSArray<ObjectType>>;
101
102        #[cfg(feature = "block2")]
103        #[unsafe(method(enumerateObjectsUsingBlock:))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn enumerateObjectsUsingBlock(
106            &self,
107            block: &block2::DynBlock<dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>)>,
108        );
109
110        #[cfg(feature = "block2")]
111        #[unsafe(method(enumerateObjectsWithOptions:usingBlock:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn enumerateObjectsWithOptions_usingBlock(
114            &self,
115            opts: NSEnumerationOptions,
116            block: &block2::DynBlock<dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>)>,
117        );
118
119        #[cfg(feature = "block2")]
120        #[unsafe(method(enumerateObjectsAtIndexes:options:usingBlock:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn enumerateObjectsAtIndexes_options_usingBlock(
123            &self,
124            s: &NSIndexSet,
125            opts: NSEnumerationOptions,
126            block: &block2::DynBlock<dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>)>,
127        );
128
129        #[cfg(feature = "PhotosTypes")]
130        #[unsafe(method(countOfAssetsWithMediaType:))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn countOfAssetsWithMediaType(&self, media_type: PHAssetMediaType)
133            -> NSUInteger;
134    );
135}
136
137/// Methods declared on superclass `NSObject`.
138impl<ObjectType: Message> PHFetchResult<ObjectType> {
139    extern_methods!(
140        #[unsafe(method(init))]
141        #[unsafe(method_family = init)]
142        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
143
144        #[unsafe(method(new))]
145        #[unsafe(method_family = new)]
146        pub unsafe fn new() -> Retained<Self>;
147    );
148}