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::*;

use crate::*;

/// A value describing the target of a ray used for raycasting.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arraycasttarget?language=objc)
// NS_ENUM
#[cfg(feature = "objc2")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ARRaycastTarget(pub NSInteger);
#[cfg(feature = "objc2")]
impl ARRaycastTarget {
    /// Ray's target is an already detected plane, considering the plane's estimated size and shape.
    #[doc(alias = "ARRaycastTargetExistingPlaneGeometry")]
    pub const ExistingPlaneGeometry: Self = Self(0);
    /// Ray's target is an already detected plane, without considering the plane's size.
    #[doc(alias = "ARRaycastTargetExistingPlaneInfinite")]
    pub const ExistingPlaneInfinite: Self = Self(1);
    /// Ray's target is a plane that is estimated using the feature points around the ray.
    /// When alignment is ARRaycastTargetAlignmentAny, alignment of estimated planes is based on the normal of the real world
    /// surface corresponding to the estimated plane.
    #[doc(alias = "ARRaycastTargetEstimatedPlane")]
    pub const EstimatedPlane: Self = Self(2);
}

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

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

/// A value describing the alignment of a target.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arraycasttargetalignment?language=objc)
// NS_ENUM
#[cfg(feature = "objc2")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ARRaycastTargetAlignment(pub NSInteger);
#[cfg(feature = "objc2")]
impl ARRaycastTargetAlignment {
    /// A target that is horizontal with respect to gravity.
    #[doc(alias = "ARRaycastTargetAlignmentHorizontal")]
    pub const Horizontal: Self = Self(0);
    /// A target that is vertical with respect to gravity.
    #[doc(alias = "ARRaycastTargetAlignmentVertical")]
    pub const Vertical: Self = Self(1);
    /// A target that is in any alignment, inclusive of horizontal and vertical.
    #[doc(alias = "ARRaycastTargetAlignmentAny")]
    pub const Any: Self = Self(2);
}

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

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

#[cfg(feature = "objc2")]
extern_class!(
    /// Representation of a ray and its target which is used for raycasting.
    ///
    /// Represents a 3D ray and its target which is used to perform raycasting.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arraycastquery?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct ARRaycastQuery;
);

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

#[cfg(feature = "objc2")]
impl ARRaycastQuery {
    extern_methods!(
        /// Type of target where the ray should terminate.
        #[unsafe(method(target))]
        #[unsafe(method_family = none)]
        pub unsafe fn target(&self) -> ARRaycastTarget;

        /// The alignment of the target that should be considered for raycasting.
        #[unsafe(method(targetAlignment))]
        #[unsafe(method_family = none)]
        pub unsafe fn targetAlignment(&self) -> ARRaycastTargetAlignment;

        #[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(&self) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2")]
impl ARRaycastQuery {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new_class() -> Retained<Self>;
    );
}