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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/intents/inobjectsection?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct INObjectSection<ObjectType: ?Sized = AnyObject>;
);

impl<ObjectType: ?Sized + Message> INObjectSection<ObjectType> {
    /// Unchecked conversion of the generic parameter.
    ///
    /// # Safety
    ///
    /// The generic must be valid to reinterpret as the given type.
    #[inline]
    pub unsafe fn cast_unchecked<NewObjectType: ?Sized + Message>(
        &self,
    ) -> &INObjectSection<NewObjectType> {
        unsafe { &*((self as *const Self).cast()) }
    }
}

extern_conformance!(
    unsafe impl<ObjectType: ?Sized + NSCoding> NSCoding for INObjectSection<ObjectType> {}
);

extern_conformance!(
    unsafe impl<ObjectType: ?Sized> NSCopying for INObjectSection<ObjectType> {}
);

unsafe impl<ObjectType: ?Sized + Message> CopyingHelper for INObjectSection<ObjectType> {
    type Result = Self;
}

extern_conformance!(
    unsafe impl<ObjectType: ?Sized> NSObjectProtocol for INObjectSection<ObjectType> {}
);

extern_conformance!(
    unsafe impl<ObjectType: ?Sized + NSSecureCoding> NSSecureCoding for INObjectSection<ObjectType> {}
);

impl<ObjectType: Message> INObjectSection<ObjectType> {
    extern_methods!(
        #[unsafe(method(title))]
        #[unsafe(method_family = none)]
        pub unsafe fn title(&self) -> Option<Retained<NSString>>;

        #[unsafe(method(items))]
        #[unsafe(method_family = none)]
        pub unsafe fn items(&self) -> Retained<NSArray<ObjectType>>;

        #[unsafe(method(initWithTitle:items:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithTitle_items(
            this: Allocated<Self>,
            title: Option<&NSString>,
            items: &NSArray<ObjectType>,
        ) -> Retained<Self>;

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

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