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")]
45unsafe impl NSCopying for VNTrackingRequest {}
46
47#[cfg(feature = "VNRequest")]
48unsafe impl CopyingHelper for VNTrackingRequest {
49    type Result = Self;
50}
51
52#[cfg(feature = "VNRequest")]
53unsafe impl NSObjectProtocol for VNTrackingRequest {}
54
55#[cfg(feature = "VNRequest")]
56impl VNTrackingRequest {
57    extern_methods!(
58        #[cfg(feature = "VNObservation")]
59        /// 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).
60        #[unsafe(method(inputObservation))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn inputObservation(&self) -> Retained<VNDetectedObjectObservation>;
63
64        #[cfg(feature = "VNObservation")]
65        /// Setter for [`inputObservation`][Self::inputObservation].
66        #[unsafe(method(setInputObservation:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn setInputObservation(&self, input_observation: &VNDetectedObjectObservation);
69
70        /// 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)
71        #[unsafe(method(trackingLevel))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn trackingLevel(&self) -> VNRequestTrackingLevel;
74
75        /// Setter for [`trackingLevel`][Self::trackingLevel].
76        #[unsafe(method(setTrackingLevel:))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn setTrackingLevel(&self, tracking_level: VNRequestTrackingLevel);
79
80        /// 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
81        #[unsafe(method(isLastFrame))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn isLastFrame(&self) -> bool;
84
85        /// Setter for [`isLastFrame`][Self::isLastFrame].
86        #[unsafe(method(setLastFrame:))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn setLastFrame(&self, last_frame: bool);
89
90        #[unsafe(method(init))]
91        #[unsafe(method_family = init)]
92        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
93
94        #[cfg(feature = "block2")]
95        #[unsafe(method(initWithCompletionHandler:))]
96        #[unsafe(method_family = init)]
97        pub unsafe fn initWithCompletionHandler(
98            this: Allocated<Self>,
99            completion_handler: VNRequestCompletionHandler,
100        ) -> Retained<Self>;
101    );
102}
103
104/// Methods declared on superclass `NSObject`.
105#[cfg(feature = "VNRequest")]
106impl VNTrackingRequest {
107    extern_methods!(
108        #[unsafe(method(new))]
109        #[unsafe(method_family = new)]
110        pub unsafe fn new() -> Retained<Self>;
111    );
112}