objc2_gameplay_kit/generated/
GKGraph.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    /// Representation of a directed graph of GKGraphNodes
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkgraph?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct GKGraph;
17);
18
19extern_conformance!(
20    unsafe impl NSCoding for GKGraph {}
21);
22
23extern_conformance!(
24    unsafe impl NSCopying for GKGraph {}
25);
26
27unsafe impl CopyingHelper for GKGraph {
28    type Result = Self;
29}
30
31extern_conformance!(
32    unsafe impl NSObjectProtocol for GKGraph {}
33);
34
35extern_conformance!(
36    unsafe impl NSSecureCoding for GKGraph {}
37);
38
39impl GKGraph {
40    extern_methods!(
41        #[cfg(feature = "GKGraphNode")]
42        /// The list of nodes in this graph
43        #[unsafe(method(nodes))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn nodes(&self) -> Option<Retained<NSArray<GKGraphNode>>>;
46
47        #[cfg(feature = "GKGraphNode")]
48        /// Creates a graph with the provided array of nodes.
49        ///
50        /// Parameter `nodes`: the nodes to create the graph with
51        #[unsafe(method(graphWithNodes:))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn graphWithNodes(nodes: &NSArray<GKGraphNode>) -> Retained<Self>;
54
55        #[cfg(feature = "GKGraphNode")]
56        #[unsafe(method(initWithNodes:))]
57        #[unsafe(method_family = init)]
58        pub unsafe fn initWithNodes(
59            this: Allocated<Self>,
60            nodes: &NSArray<GKGraphNode>,
61        ) -> Retained<Self>;
62
63        #[cfg(feature = "GKGraphNode")]
64        /// Connects the node to this graph via the lowest cost node to reach in this graph
65        ///
66        /// Parameter `node`: the node to connect
67        ///
68        /// Parameter `bidirectional`: should the connection be bidirectional? Otherwise it is one way connected into the graph
69        #[unsafe(method(connectNodeToLowestCostNode:bidirectional:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn connectNodeToLowestCostNode_bidirectional(
72            &self,
73            node: &GKGraphNode,
74            bidirectional: bool,
75        );
76
77        #[cfg(feature = "GKGraphNode")]
78        /// Removes nodes from this graph.
79        /// All connections starting and/or ending with this node are removed.
80        ///
81        /// Parameter `nodes`: an array of nodes to be removed
82        #[unsafe(method(removeNodes:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn removeNodes(&self, nodes: &NSArray<GKGraphNode>);
85
86        #[cfg(feature = "GKGraphNode")]
87        /// Adds nodes to this graph.  No new connections are added.
88        /// If the node already exists in this graph this does nothing.
89        ///
90        /// Parameter `nodes`: and array of nodes to be added
91        #[unsafe(method(addNodes:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn addNodes(&self, nodes: &NSArray<GKGraphNode>);
94
95        #[cfg(feature = "GKGraphNode")]
96        /// Attempts to find the optimal path between the two nodes indicated.
97        /// If such a path exists, it is returned in start to end order.
98        /// If it doesn't exist, the array returned will be empty.
99        /// Asserts if neither of these nodes are in this graph.  Use [GKGraphNode findPathFromNode:] instead.
100        ///
101        /// Parameter `startNode`: node to start pathing from
102        ///
103        /// Parameter `endNode`: goal node of the pathfinding attempt
104        #[unsafe(method(findPathFromNode:toNode:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn findPathFromNode_toNode(
107            &self,
108            start_node: &GKGraphNode,
109            end_node: &GKGraphNode,
110        ) -> Retained<NSArray<GKGraphNode>>;
111    );
112}
113
114/// Methods declared on superclass `NSObject`.
115impl GKGraph {
116    extern_methods!(
117        #[unsafe(method(init))]
118        #[unsafe(method_family = init)]
119        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
120
121        #[unsafe(method(new))]
122        #[unsafe(method_family = new)]
123        pub unsafe fn new() -> Retained<Self>;
124    );
125}