objc2_gameplay_kit/generated/GKOctree.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::*;
5
6use crate::*;
7
8extern_class!(
9 /// The individual node(s) that make up a GKOctree.
10 /// Used as a hint for faster removal via [GKOctree removeData:WithNode:]
11 ///
12 /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkoctreenode?language=objc)
13 #[unsafe(super(NSObject))]
14 #[derive(Debug, PartialEq, Eq, Hash)]
15 pub struct GKOctreeNode;
16);
17
18extern_conformance!(
19 unsafe impl NSObjectProtocol for GKOctreeNode {}
20);
21
22impl GKOctreeNode {
23 extern_methods!();
24}
25
26/// Methods declared on superclass `NSObject`.
27impl GKOctreeNode {
28 extern_methods!(
29 #[unsafe(method(init))]
30 #[unsafe(method_family = init)]
31 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
32
33 #[unsafe(method(new))]
34 #[unsafe(method_family = new)]
35 pub unsafe fn new() -> Retained<Self>;
36 );
37}
38
39extern_class!(
40 /// A tree data structure where each level has 8 children that subdivide a given space into the eight octants.
41 /// Stores arbitrary NSObject elements via points and boxes.
42 ///
43 /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkoctree?language=objc)
44 #[unsafe(super(NSObject))]
45 #[derive(Debug, PartialEq, Eq, Hash)]
46 pub struct GKOctree<ElementType: ?Sized = AnyObject>;
47);
48
49impl<ElementType: ?Sized + Message + AsRef<NSObject>> GKOctree<ElementType> {
50 /// Unchecked conversion of the generic parameter.
51 ///
52 /// # Safety
53 ///
54 /// The generic must be valid to reinterpret as the given type.
55 #[inline]
56 pub unsafe fn cast_unchecked<NewElementType: ?Sized + Message + AsRef<NSObject>>(
57 &self,
58 ) -> &GKOctree<NewElementType> {
59 unsafe { &*((self as *const Self).cast()) }
60 }
61}
62
63extern_conformance!(
64 unsafe impl<ElementType: ?Sized + AsRef<NSObject>> NSObjectProtocol for GKOctree<ElementType> {}
65);
66
67impl<ElementType: Message + AsRef<NSObject>> GKOctree<ElementType> {
68 extern_methods!(
69 /// Removes the given NSObject from this octree
70 /// Note that this is an exhaustive search and is can be slow for larger trees.
71 /// Cache the relevant GKOctreeNode and use removeElement:WithNode: for better performance.
72 ///
73 ///
74 /// Parameter `element`: the element to be removed
75 ///
76 /// Returns: returns YES if the data was removed, NO otherwise
77 #[unsafe(method(removeElement:))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn removeElement(&self, element: &ElementType) -> bool;
80
81 /// Removes the given NSObject from the given node
82 /// Note that this is not an exhaustive search and is faster than removeData:
83 ///
84 ///
85 /// Parameter `element`: the element to be removed
86 ///
87 /// Parameter `node`: the node in which this data resides
88 ///
89 /// Returns: returns YES if the element was removed, NO otherwise
90 #[unsafe(method(removeElement:withNode:))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn removeElement_withNode(
93 &self,
94 element: &ElementType,
95 node: &GKOctreeNode,
96 ) -> bool;
97 );
98}
99
100/// Methods declared on superclass `NSObject`.
101impl<ElementType: Message + AsRef<NSObject>> GKOctree<ElementType> {
102 extern_methods!(
103 #[unsafe(method(init))]
104 #[unsafe(method_family = init)]
105 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
106
107 #[unsafe(method(new))]
108 #[unsafe(method_family = new)]
109 pub unsafe fn new() -> Retained<Self>;
110 );
111}