objc2_vision/generated/
VNClassifyImageRequest.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::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10    /// A request for classifying an image.
11    ///
12    ///
13    /// This request will produce a collection of VNClassificationObservation objects which describe an image.
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnclassifyimagerequest?language=objc)
16    #[unsafe(super(VNImageBasedRequest, VNRequest, NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    #[cfg(feature = "VNRequest")]
19    pub struct VNClassifyImageRequest;
20);
21
22#[cfg(feature = "VNRequest")]
23extern_conformance!(
24    unsafe impl NSCopying for VNClassifyImageRequest {}
25);
26
27#[cfg(feature = "VNRequest")]
28unsafe impl CopyingHelper for VNClassifyImageRequest {
29    type Result = Self;
30}
31
32#[cfg(feature = "VNRequest")]
33extern_conformance!(
34    unsafe impl NSObjectProtocol for VNClassifyImageRequest {}
35);
36
37#[cfg(feature = "VNRequest")]
38impl VNClassifyImageRequest {
39    extern_methods!(
40        #[cfg(feature = "VNObservation")]
41        /// Obtain the collection of classifications currently recognized by the Vision framework.
42        ///
43        ///
44        /// Parameter `requestRevision`: The revision of the request for which classifications should be reported.
45        ///
46        ///
47        /// Parameter `error`: The address of the variable that will be populated with the error when the call fails.
48        ///
49        ///
50        /// Returns: the collection of classifications for the revision, or nil if an error was encountered.
51        #[deprecated]
52        #[unsafe(method(knownClassificationsForRevision:error:_))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn knownClassificationsForRevision_error(
55            request_revision: NSUInteger,
56        ) -> Result<Retained<NSArray<VNClassificationObservation>>, Retained<NSError>>;
57
58        /// Obtain the collection of identifiers supported by the target request.
59        ///
60        /// This method will return the collection of all possible classification identifiers that are produced by the target request based on its current state of configuration at the time of the call.
61        ///
62        ///
63        /// Parameter `error`: The address of the variable that will be populated with the error if the call fails.
64        ///
65        ///
66        /// Returns: The collection of classification identifiers, or nil if a failure occurs.
67        #[unsafe(method(supportedIdentifiersAndReturnError:_))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn supportedIdentifiersAndReturnError(
70            &self,
71        ) -> Result<Retained<NSArray<NSString>>, Retained<NSError>>;
72
73        #[cfg(feature = "VNObservation")]
74        /// VNClassificationObservation results.
75        #[unsafe(method(results))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn results(&self) -> Option<Retained<NSArray<VNClassificationObservation>>>;
78    );
79}
80
81/// Methods declared on superclass `VNRequest`.
82#[cfg(feature = "VNRequest")]
83impl VNClassifyImageRequest {
84    extern_methods!(
85        /// Creates a new VNRequest with no completion handler.
86        #[unsafe(method(init))]
87        #[unsafe(method_family = init)]
88        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
89
90        #[cfg(feature = "block2")]
91        /// Creates a new VNRequest with an optional completion handler.
92        ///
93        ///
94        /// Parameter `completionHandler`: The block to be invoked after the request has completed its processing. The completion handler gets executed on the same dispatch queue as the request being executed.
95        ///
96        /// # Safety
97        ///
98        /// `completion_handler` must be a valid pointer or null.
99        #[unsafe(method(initWithCompletionHandler:))]
100        #[unsafe(method_family = init)]
101        pub unsafe fn initWithCompletionHandler(
102            this: Allocated<Self>,
103            completion_handler: VNRequestCompletionHandler,
104        ) -> Retained<Self>;
105    );
106}
107
108/// Methods declared on superclass `NSObject`.
109#[cfg(feature = "VNRequest")]
110impl VNClassifyImageRequest {
111    extern_methods!(
112        #[unsafe(method(new))]
113        #[unsafe(method_family = new)]
114        pub unsafe fn new() -> Retained<Self>;
115    );
116}
117
118/// Classification with a taxonomy of 1,303 possible identifiers.
119///
120/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnclassifyimagerequestrevision1?language=objc)
121pub static VNClassifyImageRequestRevision1: NSUInteger = 1;
122
123/// The same taxonomy as `VNClassifyImageRequestRevision1` but with improved accuracy, reduced latency and memory utilization.
124///
125/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnclassifyimagerequestrevision2?language=objc)
126pub static VNClassifyImageRequestRevision2: NSUInteger = 2;