objc2_game_controller/generated/
GCTypes.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcpoint2?language=objc)
11#[repr(C)]
12#[derive(Clone, Copy, Debug, PartialEq)]
13pub struct GCPoint2 {
14    pub x: c_float,
15    pub y: c_float,
16}
17
18unsafe impl Encode for GCPoint2 {
19    const ENCODING: Encoding =
20        Encoding::Struct("GCPoint2", &[<c_float>::ENCODING, <c_float>::ENCODING]);
21}
22
23unsafe impl RefEncode for GCPoint2 {
24    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
25}
26
27extern "C" {
28    /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcpoint2zero?language=objc)
29    pub static GCPoint2Zero: GCPoint2;
30}
31
32impl GCPoint2 {
33    // TODO: pub fn GCPoint2Make(x: c_float,y: c_float,) -> GCPoint2;
34
35    // TODO: pub fn GCPoint2Equal(point1: GCPoint2,point2: GCPoint2,) -> bool;
36}
37
38#[inline]
39pub unsafe extern "C-unwind" fn NSStringFromGCPoint2(point: GCPoint2) -> Retained<NSString> {
40    extern "C-unwind" {
41        fn NSStringFromGCPoint2(point: GCPoint2) -> *mut NSString;
42    }
43    let ret = unsafe { NSStringFromGCPoint2(point) };
44    unsafe { Retained::retain_autoreleased(ret) }
45        .expect("function was marked as returning non-null, but actually returned NULL")
46}
47
48mod private_NSValueGCTypes {
49    pub trait Sealed {}
50}
51
52/// Category "GCTypes" on [`NSValue`].
53#[doc(alias = "GCTypes")]
54pub unsafe trait NSValueGCTypes: ClassType + Sized + private_NSValueGCTypes::Sealed {
55    extern_methods!(
56        #[unsafe(method(valueWithGCPoint2:))]
57        #[unsafe(method_family = none)]
58        unsafe fn valueWithGCPoint2(point: GCPoint2) -> Retained<Self>;
59
60        #[unsafe(method(GCPoint2Value))]
61        #[unsafe(method_family = none)]
62        unsafe fn GCPoint2Value(&self) -> GCPoint2;
63    );
64}
65
66impl private_NSValueGCTypes::Sealed for NSValue {}
67unsafe impl NSValueGCTypes for NSValue {}