objc2_vision/generated/
VNTrackingRequest.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/// Tracking level options to favor speed or location accuracy. The VNRequestTrackingLevelFast is the default option used by trackers.
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnrequesttrackinglevel?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct VNRequestTrackingLevel(pub NSUInteger);
17impl VNRequestTrackingLevel {
18    #[doc(alias = "VNRequestTrackingLevelAccurate")]
19    pub const Accurate: Self = Self(0);
20    #[doc(alias = "VNRequestTrackingLevelFast")]
21    pub const Fast: Self = Self(1);
22}
23
24unsafe impl Encode for VNRequestTrackingLevel {
25    const ENCODING: Encoding = NSUInteger::ENCODING;
26}
27
28unsafe impl RefEncode for VNRequestTrackingLevel {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32extern_class!(
33    /// A base class for all tracking requests.
34    ///
35    /// Since this class is not meant to be directly instantiated, no initializers are available.
36    ///
37    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vntrackingrequest?language=objc)
38    #[unsafe(super(VNImageBasedRequest, VNRequest, NSObject))]
39    #[derive(Debug, PartialEq, Eq, Hash)]
40    #[cfg(feature = "VNRequest")]
41    pub struct VNTrackingRequest;
42);
43
44#[cfg(feature = "VNRequest")]
45extern_conformance!(
46    unsafe impl NSCopying for VNTrackingRequest {}
47);
48
49#[cfg(feature = "VNRequest")]
50unsafe impl CopyingHelper for VNTrackingRequest {
51    type Result = Self;
52}
53
54#[cfg(feature = "VNRequest")]
55extern_conformance!(
56    unsafe impl NSObjectProtocol for VNTrackingRequest {}
57);
58
59#[cfg(feature = "VNRequest")]
60impl VNTrackingRequest {
61    extern_methods!(
62        #[cfg(feature = "VNObservation")]
63        /// The observation object that defines a region to track. Providing an observation not returned from a tracker (e.g. user-defined, or from a detector) begins a new tracker for the sequence. Providing an observation that was returned from a tracker continues the use of that tracker, to track the region to the next frame. In general, unless documented in the request's documentation, the rectangle must be defined in normalized coordinates (both dimensions normalized to [0,1] with the origin at the lower-left corner).
64        #[unsafe(method(inputObservation))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn inputObservation(&self) -> Retained<VNDetectedObjectObservation>;
67
68        #[cfg(feature = "VNObservation")]
69        /// Setter for [`inputObservation`][Self::inputObservation].
70        #[unsafe(method(setInputObservation:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn setInputObservation(&self, input_observation: &VNDetectedObjectObservation);
73
74        /// Tracking level allows tuning tracking algorithm to prefer speed (VNRequestTrackingLevelFast) vs. tracking object location accuracy (VNRequestTrackingLevelAccurate). This property has no effect on general purpose object tracker (VNTrackObjectRequest) revision 2 (VNTrackObjectRequestRevision2)
75        #[unsafe(method(trackingLevel))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn trackingLevel(&self) -> VNRequestTrackingLevel;
78
79        /// Setter for [`trackingLevel`][Self::trackingLevel].
80        #[unsafe(method(setTrackingLevel:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn setTrackingLevel(&self, tracking_level: VNRequestTrackingLevel);
83
84        /// This property allows marking the last frame for tracking using current tracker. If set to YES, the results for this frame will be processed and returned and the current tracker will be released to the pool of available trackers
85        #[unsafe(method(isLastFrame))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn isLastFrame(&self) -> bool;
88
89        /// Setter for [`isLastFrame`][Self::isLastFrame].
90        #[unsafe(method(setLastFrame:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn setLastFrame(&self, last_frame: bool);
93
94        #[unsafe(method(init))]
95        #[unsafe(method_family = init)]
96        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
97
98        #[cfg(feature = "block2")]
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 VNTrackingRequest {
111    extern_methods!(
112        #[unsafe(method(new))]
113        #[unsafe(method_family = new)]
114        pub unsafe fn new() -> Retained<Self>;
115    );
116}