use objc2::{
extern_class, extern_conformance, extern_methods, msg_send,
rc::{Allocated, Retained},
runtime::NSObject,
};
use objc2_foundation::{NSNumber, NSObjectProtocol};
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRasterizationRateSampleArray;
);
extern_conformance!(
unsafe impl NSObjectProtocol for MTLRasterizationRateSampleArray {}
);
impl MTLRasterizationRateSampleArray {
pub fn object_at_indexed_subscript(
&self,
index: usize,
) -> f32 {
let value: Retained<NSNumber> = unsafe { msg_send![self, objectAtIndexedSubscript: index] };
value.as_f32()
}
pub fn set_object_at_indexed_subscript(
&self,
value: f32,
index: usize,
) {
let value = NSNumber::new_f32(value);
unsafe {
let _: () = msg_send![self, setObject: &*value, atIndexedSubscript: index];
}
}
}
impl MTLRasterizationRateSampleArray {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}