use objc2::{extern_class, extern_conformance, extern_methods, msg_send, rc::Retained, runtime::NSObject};
use objc2_foundation::{NSObjectProtocol, NSString};
use crate::MTLDataType;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLFunctionConstant;
);
extern_conformance!(
unsafe impl NSObjectProtocol for MTLFunctionConstant {}
);
impl MTLFunctionConstant {
extern_methods!(
#[unsafe(method(type))]
#[unsafe(method_family = none)]
pub fn data_type(&self) -> MTLDataType;
#[unsafe(method(index))]
#[unsafe(method_family = none)]
pub fn index(&self) -> usize;
#[unsafe(method(required))]
#[unsafe(method_family = none)]
pub fn required(&self) -> bool;
);
pub fn name(&self) -> String {
let name: Retained<NSString> = unsafe { msg_send![self, name] };
name.to_string()
}
}