objc2_game_controller/generated/
GCPhysicalInputElement.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_protocol!(
10    /// The
11    /// `GCPhysicalInputElement`protocol is a base protocol for specific types
12    /// of elements that represent controls on a device.
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcphysicalinputelement?language=objc)
15    pub unsafe trait GCPhysicalInputElement: NSObjectProtocol {
16        /// The set of aliases that can be used to access this element with keyed subscript
17        /// notation.
18        #[unsafe(method(aliases))]
19        #[unsafe(method_family = none)]
20        unsafe fn aliases(&self) -> Retained<NSSet<NSString>>;
21
22        /// The element's localized display name.
23        ///
24        /// This is the string that your app should display in any on-screen messages
25        /// instructing the user to interact with the control.  For example:
26        ///
27        /// "Press \(buttonA.localizedName) to jump!"
28        ///
29        /// Do not cache this value - it can change when the user remaps controls.
30        #[unsafe(method(localizedName))]
31        #[unsafe(method_family = none)]
32        unsafe fn localizedName(&self) -> Option<Retained<NSString>>;
33
34        /// The SF Symbols name for the element.
35        #[unsafe(method(sfSymbolsName))]
36        #[unsafe(method_family = none)]
37        unsafe fn sfSymbolsName(&self) -> Option<Retained<NSString>>;
38    }
39);
40
41extern_class!(
42    /// An instance of
43    /// `GCPhysicalInputElementCollection`contains the collection of
44    /// input elements found in a device's physical input profile.
45    ///
46    /// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcphysicalinputelementcollection?language=objc)
47    #[unsafe(super(NSObject))]
48    #[derive(Debug, PartialEq, Eq, Hash)]
49    pub struct GCPhysicalInputElementCollection<
50        Key: ?Sized = AnyObject,
51        Element: ?Sized = AnyObject,
52    >;
53);
54
55impl<
56        Key: ?Sized + Message + AsRef<NSString>,
57        Element: ?Sized + Message + GCPhysicalInputElement,
58    > GCPhysicalInputElementCollection<Key, Element>
59{
60    /// Unchecked conversion of the generic parameters.
61    ///
62    /// # Safety
63    ///
64    /// The generics must be valid to reinterpret as the given types.
65    #[inline]
66    pub unsafe fn cast_unchecked<
67        NewKey: ?Sized + Message + AsRef<NSString>,
68        NewElement: ?Sized + Message + GCPhysicalInputElement,
69    >(
70        &self,
71    ) -> &GCPhysicalInputElementCollection<NewKey, NewElement> {
72        unsafe { &*((self as *const Self).cast()) }
73    }
74}
75
76extern_conformance!(
77    unsafe impl<Key: ?Sized + AsRef<NSString>, Element: ?Sized + GCPhysicalInputElement>
78        NSFastEnumeration for GCPhysicalInputElementCollection<Key, Element>
79    {
80    }
81);
82
83extern_conformance!(
84    unsafe impl<Key: ?Sized + AsRef<NSString>, Element: ?Sized + GCPhysicalInputElement>
85        NSObjectProtocol for GCPhysicalInputElementCollection<Key, Element>
86    {
87    }
88);
89
90impl<Key: Message + AsRef<NSString>, Element: Message + GCPhysicalInputElement>
91    GCPhysicalInputElementCollection<Key, Element>
92{
93    extern_methods!(
94        #[unsafe(method(new))]
95        #[unsafe(method_family = new)]
96        pub unsafe fn new() -> Retained<Self>;
97
98        #[unsafe(method(init))]
99        #[unsafe(method_family = init)]
100        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
101
102        /// The number of elements in the collection.
103        #[unsafe(method(count))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn count(&self) -> NSUInteger;
106
107        /// Returns the element associated with a given alias.
108        ///
109        ///
110        /// Parameter `alias`: The alias for which to return the corresponding element.  Typically, you
111        /// pass one of the constants defined in
112        /// `GCInputNames.h.`
113        /// Returns: The element associated with
114        /// _alias,_or nil if no element is associated
115        /// with
116        /// _alias._
117        #[unsafe(method(elementForAlias:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn elementForAlias(&self, alias: &Key) -> Option<Retained<Element>>;
120
121        #[unsafe(method(objectForKeyedSubscript:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn objectForKeyedSubscript(&self, key: &Key) -> Option<Retained<Element>>;
124
125        /// # Safety
126        ///
127        /// The returned enumerator's underlying collection should not be mutated while in use.
128        #[unsafe(method(elementEnumerator))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn elementEnumerator(&self) -> Retained<NSEnumerator<Element>>;
131    );
132}