objc2_gameplay_kit/generated/
GKGridGraph.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
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkgridgraph?language=objc)
12    #[unsafe(super(GKGraph, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
15    pub struct GKGridGraph<NodeType: ?Sized = AnyObject>;
16);
17
18#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
19impl<NodeType: ?Sized + Message + AsRef<GKGridGraphNode>> GKGridGraph<NodeType> {
20    /// Unchecked conversion of the generic parameter.
21    ///
22    /// # Safety
23    ///
24    /// The generic must be valid to reinterpret as the given type.
25    #[inline]
26    pub unsafe fn cast_unchecked<NewNodeType: ?Sized + Message + AsRef<GKGridGraphNode>>(
27        &self,
28    ) -> &GKGridGraph<NewNodeType> {
29        unsafe { &*((self as *const Self).cast()) }
30    }
31}
32
33#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
34extern_conformance!(
35    unsafe impl<NodeType: ?Sized + NSCoding + AsRef<GKGridGraphNode>> NSCoding
36        for GKGridGraph<NodeType>
37    {
38    }
39);
40
41#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
42extern_conformance!(
43    unsafe impl<NodeType: ?Sized + AsRef<GKGridGraphNode>> NSCopying for GKGridGraph<NodeType> {}
44);
45
46#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
47unsafe impl<NodeType: ?Sized + Message + AsRef<GKGridGraphNode>> CopyingHelper
48    for GKGridGraph<NodeType>
49{
50    type Result = Self;
51}
52
53#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
54extern_conformance!(
55    unsafe impl<NodeType: ?Sized + AsRef<GKGridGraphNode>> NSObjectProtocol for GKGridGraph<NodeType> {}
56);
57
58#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
59extern_conformance!(
60    unsafe impl<NodeType: ?Sized + NSSecureCoding + AsRef<GKGridGraphNode>> NSSecureCoding
61        for GKGridGraph<NodeType>
62    {
63    }
64);
65
66#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
67impl<NodeType: Message + AsRef<GKGridGraphNode>> GKGridGraph<NodeType> {
68    extern_methods!(
69        #[unsafe(method(gridWidth))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn gridWidth(&self) -> NSUInteger;
72
73        #[unsafe(method(gridHeight))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn gridHeight(&self) -> NSUInteger;
76
77        #[unsafe(method(diagonalsAllowed))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn diagonalsAllowed(&self) -> bool;
80
81        /// Connects the given GKGridGraphNode to this graph by connecting it to it's adjacent nodes on the grid
82        /// Input node must have coordinates within the rectangle specified by minCoordinates and maxCoordinates
83        ///
84        /// Parameter `node`: the node to be connected
85        #[unsafe(method(connectNodeToAdjacentNodes:))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn connectNodeToAdjacentNodes(&self, node: &GKGridGraphNode);
88
89        /// Returns the class of the specified generic index
90        #[unsafe(method(classForGenericArgumentAtIndex:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn classForGenericArgumentAtIndex(&self, index: NSUInteger)
93            -> &'static AnyClass;
94    );
95}
96
97/// Methods declared on superclass `GKGraph`.
98#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
99impl<NodeType: Message + AsRef<GKGridGraphNode>> GKGridGraph<NodeType> {
100    extern_methods!(
101        /// Creates a graph with the provided array of nodes.
102        ///
103        /// Parameter `nodes`: the nodes to create the graph with
104        #[unsafe(method(graphWithNodes:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn graphWithNodes(nodes: &NSArray<GKGraphNode>) -> Retained<Self>;
107
108        #[unsafe(method(initWithNodes:))]
109        #[unsafe(method_family = init)]
110        pub unsafe fn initWithNodes(
111            this: Allocated<Self>,
112            nodes: &NSArray<GKGraphNode>,
113        ) -> Retained<Self>;
114    );
115}
116
117/// Methods declared on superclass `NSObject`.
118#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
119impl<NodeType: Message + AsRef<GKGridGraphNode>> GKGridGraph<NodeType> {
120    extern_methods!(
121        #[unsafe(method(init))]
122        #[unsafe(method_family = init)]
123        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
124
125        #[unsafe(method(new))]
126        #[unsafe(method_family = new)]
127        pub unsafe fn new() -> Retained<Self>;
128    );
129}