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::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

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

impl<ObjectType: ?Sized + Message> INObjectCollection<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,
    ) -> &INObjectCollection<NewObjectType> {
        unsafe { &*((self as *const Self).cast()) }
    }
}

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

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

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

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

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

impl<ObjectType: Message> INObjectCollection<ObjectType> {
    extern_methods!(
        #[cfg(feature = "INObjectSection")]
        #[unsafe(method(sections))]
        #[unsafe(method_family = none)]
        pub unsafe fn sections(&self) -> Retained<NSArray<INObjectSection<ObjectType>>>;

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

        #[unsafe(method(usesIndexedCollation))]
        #[unsafe(method_family = none)]
        pub unsafe fn usesIndexedCollation(&self) -> bool;

        /// Setter for [`usesIndexedCollation`][Self::usesIndexedCollation].
        #[unsafe(method(setUsesIndexedCollation:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUsesIndexedCollation(&self, uses_indexed_collation: bool);

        #[cfg(feature = "INObjectSection")]
        #[unsafe(method(initWithSections:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithSections(
            this: Allocated<Self>,
            sections: &NSArray<INObjectSection<ObjectType>>,
        ) -> Retained<Self>;

        #[unsafe(method(initWithItems:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithItems(
            this: Allocated<Self>,
            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> INObjectCollection<ObjectType> {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}