objc2_tv_services/generated/
TVTopShelfItemCollection.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10    /// An object that represents a collection of Top Shelf items that can be displayed in a section.
11    ///
12    /// See also [Apple's documentation](https://developer.apple.com/documentation/tvservices/tvtopshelfitemcollection?language=objc)
13    #[unsafe(super(TVTopShelfObject, NSObject))]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    #[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
16    pub struct TVTopShelfItemCollection<Item: ?Sized = AnyObject>;
17);
18
19#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
20impl<Item: ?Sized + Message + AsRef<TVTopShelfItem>> TVTopShelfItemCollection<Item> {
21    /// Unchecked conversion of the generic parameter.
22    ///
23    /// # Safety
24    ///
25    /// The generic must be valid to reinterpret as the given type.
26    #[inline]
27    pub unsafe fn cast_unchecked<NewItem: ?Sized + Message + AsRef<TVTopShelfItem>>(
28        &self,
29    ) -> &TVTopShelfItemCollection<NewItem> {
30        unsafe { &*((self as *const Self).cast()) }
31    }
32}
33
34#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
35extern_conformance!(
36    unsafe impl<Item: ?Sized + AsRef<TVTopShelfItem>> NSObjectProtocol
37        for TVTopShelfItemCollection<Item>
38    {
39    }
40);
41
42#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
43impl<Item: Message + AsRef<TVTopShelfItem>> TVTopShelfItemCollection<Item> {
44    extern_methods!(
45        /// The collection's items.
46        #[unsafe(method(items))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn items(&self) -> Retained<NSArray<Item>>;
49
50        /// Create a collection of items.
51        #[unsafe(method(initWithItems:))]
52        #[unsafe(method_family = init)]
53        pub unsafe fn initWithItems(this: Allocated<Self>, items: &NSArray<Item>)
54            -> Retained<Self>;
55    );
56}
57
58/// Methods declared on superclass `TVTopShelfObject`.
59#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
60impl<Item: Message + AsRef<TVTopShelfItem>> TVTopShelfItemCollection<Item> {
61    extern_methods!(
62        #[unsafe(method(init))]
63        #[unsafe(method_family = init)]
64        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
65
66        #[unsafe(method(new))]
67        #[unsafe(method_family = new)]
68        pub unsafe fn new() -> Retained<Self>;
69    );
70}