use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct GKRTreeSplitStrategy(pub NSInteger);
impl GKRTreeSplitStrategy {
#[doc(alias = "GKRTreeSplitStrategyHalve")]
pub const Halve: Self = Self(0);
#[doc(alias = "GKRTreeSplitStrategyLinear")]
pub const Linear: Self = Self(1);
#[doc(alias = "GKRTreeSplitStrategyQuadratic")]
pub const Quadratic: Self = Self(2);
#[doc(alias = "GKRTreeSplitStrategyReduceOverlap")]
pub const ReduceOverlap: Self = Self(3);
}
unsafe impl Encode for GKRTreeSplitStrategy {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for GKRTreeSplitStrategy {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct GKRTree<ElementType: ?Sized = AnyObject>;
);
impl<ElementType: ?Sized + Message + AsRef<NSObject>> GKRTree<ElementType> {
#[inline]
pub unsafe fn cast_unchecked<NewElementType: ?Sized + Message + AsRef<NSObject>>(
&self,
) -> &GKRTree<NewElementType> {
unsafe { &*((self as *const Self).cast()) }
}
}
extern_conformance!(
unsafe impl<ElementType: ?Sized + AsRef<NSObject>> NSObjectProtocol for GKRTree<ElementType> {}
);
impl<ElementType: Message + AsRef<NSObject>> GKRTree<ElementType> {
extern_methods!(
#[unsafe(method(queryReserve))]
#[unsafe(method_family = none)]
pub unsafe fn queryReserve(&self) -> NSUInteger;
#[unsafe(method(setQueryReserve:))]
#[unsafe(method_family = none)]
pub unsafe fn setQueryReserve(&self, query_reserve: NSUInteger);
#[unsafe(method(treeWithMaxNumberOfChildren:))]
#[unsafe(method_family = none)]
pub unsafe fn treeWithMaxNumberOfChildren(
max_number_of_children: NSUInteger,
) -> Retained<Self>;
#[unsafe(method(initWithMaxNumberOfChildren:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithMaxNumberOfChildren(
this: Allocated<Self>,
max_number_of_children: NSUInteger,
) -> Retained<Self>;
);
}
impl<ElementType: Message + AsRef<NSObject>> GKRTree<ElementType> {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}