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