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::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-foundation")]
use objc2_foundation::*;

use crate::*;

/// A value describing the alignment of a plane anchor.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arplaneanchoralignment?language=objc)
// NS_ENUM
#[cfg(feature = "objc2")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ARPlaneAnchorAlignment(pub NSInteger);
#[cfg(feature = "objc2")]
impl ARPlaneAnchorAlignment {
    /// A plane that is horizontal with respect to gravity.
    #[doc(alias = "ARPlaneAnchorAlignmentHorizontal")]
    pub const Horizontal: Self = Self(0);
    /// A plane that is vertical with respect to gravity.
    #[doc(alias = "ARPlaneAnchorAlignmentVertical")]
    pub const Vertical: Self = Self(1);
}

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

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

/// A value describing the classification status of a plane anchor.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arplaneclassificationstatus?language=objc)
// NS_ENUM
#[cfg(feature = "objc2")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ARPlaneClassificationStatus(pub NSInteger);
#[cfg(feature = "objc2")]
impl ARPlaneClassificationStatus {
    /// Plane classification is currently unavailable.
    #[doc(alias = "ARPlaneClassificationStatusNotAvailable")]
    pub const NotAvailable: Self = Self(0);
    /// ARKit has not yet determined the classification of this plane.
    #[doc(alias = "ARPlaneClassificationStatusUndetermined")]
    pub const Undetermined: Self = Self(1);
    /// ARKit is confident the plane is not any of the known classes.
    #[doc(alias = "ARPlaneClassificationStatusUnknown")]
    pub const Unknown: Self = Self(2);
    /// ARKit has a classification for the plane it is confident in.
    #[doc(alias = "ARPlaneClassificationStatusKnown")]
    pub const Known: Self = Self(3);
}

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

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

/// A value describing the classification of a plane anchor.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arplaneclassification?language=objc)
// NS_ENUM
#[cfg(feature = "objc2")]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ARPlaneClassification(pub NSInteger);
#[cfg(feature = "objc2")]
impl ARPlaneClassification {
    /// The classification is not any of the known classes.
    #[doc(alias = "ARPlaneClassificationNone")]
    pub const None: Self = Self(0);
    /// The classification is not any of the known classes.
    #[doc(alias = "ARPlaneClassificationWall")]
    pub const Wall: Self = Self(1);
    /// The classification is not any of the known classes.
    #[doc(alias = "ARPlaneClassificationFloor")]
    pub const Floor: Self = Self(2);
    /// The classification is not any of the known classes.
    #[doc(alias = "ARPlaneClassificationCeiling")]
    pub const Ceiling: Self = Self(3);
    /// The classification is not any of the known classes.
    #[doc(alias = "ARPlaneClassificationTable")]
    pub const Table: Self = Self(4);
    /// The classification is not any of the known classes.
    #[doc(alias = "ARPlaneClassificationSeat")]
    pub const Seat: Self = Self(5);
    /// The classification is not any of the known classes.
    #[doc(alias = "ARPlaneClassificationWindow")]
    pub const Window: Self = Self(6);
    /// The classification is not any of the known classes.
    #[doc(alias = "ARPlaneClassificationDoor")]
    pub const Door: Self = Self(7);
}

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

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

#[cfg(feature = "objc2")]
extern_class!(
    /// Represents the extents of a plane.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arplaneextent?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct ARPlaneExtent;
);

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

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

#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
extern_conformance!(
    unsafe impl NSCoding for ARPlaneExtent {}
);

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

#[cfg(all(feature = "objc2", feature = "objc2-foundation"))]
extern_conformance!(
    unsafe impl NSSecureCoding for ARPlaneExtent {}
);

#[cfg(feature = "objc2")]
impl ARPlaneExtent {
    extern_methods!(
        /// The rotation angle in radians of the extents around the y-axis in the anchor’s coordinate space.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(rotationOnYAxis))]
        #[unsafe(method_family = none)]
        pub unsafe fn rotationOnYAxis(&self) -> c_float;

        /// The width of the plane. Corresponds to the length of the plane along the x-axis prior to applying .rotationOnYAxis.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(width))]
        #[unsafe(method_family = none)]
        pub unsafe fn width(&self) -> c_float;

        /// The height the plane. Corresponds to the length of the plane along the z-axis prior to applying .rotationOnYAxis.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(height))]
        #[unsafe(method_family = none)]
        pub unsafe fn height(&self) -> c_float;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2")]
impl ARPlaneExtent {
    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>;
    );
}

#[cfg(feature = "objc2")]
extern_class!(
    /// An anchor representing a planar surface in the world.
    ///
    /// Planes are defined in the X and Z direction, where Y is the surface’s normal.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/arkit/arplaneanchor?language=objc)
    #[unsafe(super(ARAnchor, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "ARAnchor", feature = "objc2"))]
    pub struct ARPlaneAnchor;
);

#[cfg(all(feature = "ARAnchor", feature = "objc2"))]
unsafe impl Send for ARPlaneAnchor {}

#[cfg(all(feature = "ARAnchor", feature = "objc2"))]
unsafe impl Sync for ARPlaneAnchor {}

#[cfg(all(feature = "ARAnchor", feature = "objc2", feature = "objc2-foundation"))]
extern_conformance!(
    unsafe impl ARAnchorCopying for ARPlaneAnchor {}
);

#[cfg(all(feature = "ARAnchor", feature = "objc2", feature = "objc2-foundation"))]
extern_conformance!(
    unsafe impl NSCoding for ARPlaneAnchor {}
);

#[cfg(all(feature = "ARAnchor", feature = "objc2", feature = "objc2-foundation"))]
extern_conformance!(
    unsafe impl NSCopying for ARPlaneAnchor {}
);

#[cfg(all(feature = "ARAnchor", feature = "objc2", feature = "objc2-foundation"))]
unsafe impl CopyingHelper for ARPlaneAnchor {
    type Result = Self;
}

#[cfg(all(feature = "ARAnchor", feature = "objc2"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for ARPlaneAnchor {}
);

#[cfg(all(feature = "ARAnchor", feature = "objc2", feature = "objc2-foundation"))]
extern_conformance!(
    unsafe impl NSSecureCoding for ARPlaneAnchor {}
);

#[cfg(all(feature = "ARAnchor", feature = "objc2"))]
impl ARPlaneAnchor {
    extern_methods!(
        /// Determines whether plane classification is supported on this device.
        #[unsafe(method(isClassificationSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isClassificationSupported() -> bool;

        /// The alignment of the plane.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(alignment))]
        #[unsafe(method_family = none)]
        pub unsafe fn alignment(&self) -> ARPlaneAnchorAlignment;

        /// The extent of the plane in the anchor’s coordinate space.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(planeExtent))]
        #[unsafe(method_family = none)]
        pub unsafe fn planeExtent(&self) -> Retained<ARPlaneExtent>;

        #[cfg(feature = "ARPlaneGeometry")]
        /// Geometry of the plane in the anchor's coordinate space.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(geometry))]
        #[unsafe(method_family = none)]
        pub unsafe fn geometry(&self) -> Retained<ARPlaneGeometry>;

        /// Classification status of the plane.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(classificationStatus))]
        #[unsafe(method_family = none)]
        pub unsafe fn classificationStatus(&self) -> ARPlaneClassificationStatus;

        /// Classification of the plane.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(classification))]
        #[unsafe(method_family = none)]
        pub unsafe fn classification(&self) -> ARPlaneClassification;
    );
}

/// Methods declared on superclass `ARAnchor`.
#[cfg(all(feature = "ARAnchor", feature = "objc2"))]
impl ARPlaneAnchor {
    extern_methods!(
        /// Unavailable
        #[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>;
    );
}