objc2-intents 0.3.2

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

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/intents/inpersonhandletype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct INPersonHandleType(pub NSInteger);
impl INPersonHandleType {
    #[doc(alias = "INPersonHandleTypeUnknown")]
    pub const Unknown: Self = Self(0);
    #[doc(alias = "INPersonHandleTypeEmailAddress")]
    pub const EmailAddress: Self = Self(1);
    #[doc(alias = "INPersonHandleTypePhoneNumber")]
    pub const PhoneNumber: Self = Self(2);
}

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

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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/intents/inpersonhandle?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct INPersonHandle;
);

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

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

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

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

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

impl INPersonHandle {
    extern_methods!(
        #[unsafe(method(value))]
        #[unsafe(method_family = none)]
        pub unsafe fn value(&self) -> Option<Retained<NSString>>;

        #[unsafe(method(type))]
        #[unsafe(method_family = none)]
        pub unsafe fn r#type(&self) -> INPersonHandleType;

        #[cfg(feature = "INPersonHandleLabel")]
        #[unsafe(method(label))]
        #[unsafe(method_family = none)]
        pub unsafe fn label(&self) -> Option<Retained<INPersonHandleLabel>>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "INPersonHandleLabel")]
        #[unsafe(method(initWithValue:type:label:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithValue_type_label(
            this: Allocated<Self>,
            value: Option<&NSString>,
            r#type: INPersonHandleType,
            label: Option<&INPersonHandleLabel>,
        ) -> Retained<Self>;

        #[unsafe(method(initWithValue:type:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithValue_type(
            this: Allocated<Self>,
            value: Option<&NSString>,
            r#type: INPersonHandleType,
        ) -> Retained<Self>;
    );
}

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