objc2-car-play 0.3.2

Bindings to the CarPlay framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cplanestatus?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CPLaneStatus(pub NSInteger);
impl CPLaneStatus {
    #[doc(alias = "CPLaneStatusNotGood")]
    pub const NotGood: Self = Self(0);
    #[doc(alias = "CPLaneStatusGood")]
    pub const Good: Self = Self(1);
    #[doc(alias = "CPLaneStatusPreferred")]
    pub const Preferred: Self = Self(2);
}

unsafe impl Encode for CPLaneStatus {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for CPLaneStatus {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// `CPLane`represents information about a single lane.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cplane?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CPLane;
);

extern_conformance!(
    unsafe impl NSCoding for CPLane {}
);

extern_conformance!(
    unsafe impl NSCopying for CPLane {}
);

unsafe impl CopyingHelper for CPLane {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for CPLane {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for CPLane {}
);

impl CPLane {
    extern_methods!(
        #[deprecated = "-[CPLane initWithAngles:] or -[CPLane initWithHighlightedAngle:angles:isPreferred:]"]
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(initWithAngles:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAngles(
            this: Allocated<Self>,
            angles: &NSArray<NSMeasurement<NSUnitAngle>>,
        ) -> Retained<Self>;

        #[unsafe(method(initWithAngles:highlightedAngle:isPreferred:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAngles_highlightedAngle_isPreferred(
            this: Allocated<Self>,
            angles: &NSArray<NSMeasurement<NSUnitAngle>>,
            highlighted_angle: &NSMeasurement<NSUnitAngle>,
            preferred: bool,
        ) -> Retained<Self>;

        /// status is a
        /// `CPLaneStatus`representing the status of this lane.
        #[unsafe(method(status))]
        #[unsafe(method_family = none)]
        pub unsafe fn status(&self) -> CPLaneStatus;

        /// Setter for [`status`][Self::status].
        #[unsafe(method(setStatus:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setStatus(&self, status: CPLaneStatus);

        /// primaryAngle is the angle to be highlighted if this lane is preferred or good. If primaryAngle is present it can not be included in secondaryAngles.
        #[deprecated = "Use highlightedAngle to get value, use -[CPLane initAngles:highlightedAngle:isPreferred:] to create a CPLane with highlightedAngle set"]
        #[unsafe(method(primaryAngle))]
        #[unsafe(method_family = none)]
        pub unsafe fn primaryAngle(&self) -> Retained<NSMeasurement<NSUnitAngle>>;

        /// Setter for [`primaryAngle`][Self::primaryAngle].
        #[deprecated = "Use highlightedAngle to get value, use -[CPLane initAngles:highlightedAngle:isPreferred:] to create a CPLane with highlightedAngle set"]
        #[unsafe(method(setPrimaryAngle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPrimaryAngle(&self, primary_angle: &NSMeasurement<NSUnitAngle>);

        /// `highlightedAngle`is the angle to be highlighted. If
        /// `highlightedAngle`is present it can not be included in
        /// `angles.``highlightedAngle`must not be set if status is
        /// `CPLaneStatusNotGood`
        #[unsafe(method(highlightedAngle))]
        #[unsafe(method_family = none)]
        pub unsafe fn highlightedAngle(&self) -> Option<Retained<NSMeasurement<NSUnitAngle>>>;

        /// secondaryAngles is a list of the remaining angles of this lane guidance.
        #[deprecated = "Use angles to get value, Use -[CPLane initWithAngles:] or -[CPLane initAngles:highlightedAngle:isPreferred:] to create a CPLane with angles"]
        #[unsafe(method(secondaryAngles))]
        #[unsafe(method_family = none)]
        pub unsafe fn secondaryAngles(&self) -> Retained<NSArray<NSMeasurement<NSUnitAngle>>>;

        /// Setter for [`secondaryAngles`][Self::secondaryAngles].
        #[deprecated = "Use angles to get value, Use -[CPLane initWithAngles:] or -[CPLane initAngles:highlightedAngle:isPreferred:] to create a CPLane with angles"]
        #[unsafe(method(setSecondaryAngles:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSecondaryAngles(
            &self,
            secondary_angles: &NSArray<NSMeasurement<NSUnitAngle>>,
        );

        /// `angles`is a list of the remaining angles of this lane guidance. If
        /// `highlightedAngle`is set, that angle must not be included in
        /// `angles`
        #[unsafe(method(angles))]
        #[unsafe(method_family = none)]
        pub unsafe fn angles(&self) -> Retained<NSArray<NSMeasurement<NSUnitAngle>>>;
    );
}

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