objc2-ar-kit 0.3.2

Bindings to the ARKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-video")]
use objc2_core_video::*;

use crate::*;

/// Constants indicating the confidence level of per-pixel depth data.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arconfidencelevel?language=objc)
// NS_ENUM
#[cfg(feature = "objc2")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ARConfidenceLevel(pub NSInteger);
#[cfg(feature = "objc2")]
impl ARConfidenceLevel {
    #[doc(alias = "ARConfidenceLevelLow")]
    pub const Low: Self = Self(0);
    #[doc(alias = "ARConfidenceLevelMedium")]
    pub const Medium: Self = Self(1);
    #[doc(alias = "ARConfidenceLevelHigh")]
    pub const High: Self = Self(2);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for ARConfidenceLevel {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for ARConfidenceLevel {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

#[cfg(feature = "objc2")]
extern_class!(
    /// A container for depth data and its associated confidence.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/ardepthdata?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct ARDepthData;
);

#[cfg(feature = "objc2")]
unsafe impl Send for ARDepthData {}

#[cfg(feature = "objc2")]
unsafe impl Sync for ARDepthData {}

#[cfg(feature = "objc2")]
extern_conformance!(
    unsafe impl NSObjectProtocol for ARDepthData {}
);

#[cfg(feature = "objc2")]
impl ARDepthData {
    extern_methods!(
        #[cfg(feature = "objc2-core-video")]
        /// A pixel buffer that contains per-pixel depth data (in meters).
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// - This is not retained internally, you must ensure the object is still alive.
        /// - This might not be thread-safe.
        #[unsafe(method(depthMap))]
        #[unsafe(method_family = none)]
        pub unsafe fn depthMap(&self) -> Retained<CVPixelBuffer>;

        #[cfg(feature = "objc2-core-video")]
        /// A pixel buffer containing the confidence level for each depth value in the `depthMap`.
        ///
        /// See: ARConfidenceLevel
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// - This is not retained internally, you must ensure the object is still alive.
        /// - This might not be thread-safe.
        #[unsafe(method(confidenceMap))]
        #[unsafe(method_family = none)]
        pub unsafe fn confidenceMap(&self) -> Option<Retained<CVPixelBuffer>>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2")]
impl ARDepthData {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}