use objc2::{Message, extern_protocol, msg_send, rc::Retained};
use objc2_foundation::{NSObjectProtocol, NSString};
use crate::*;
extern_protocol!(
pub unsafe trait MTL4BinaryFunction: NSObjectProtocol + Send + Sync {
#[unsafe(method(functionType))]
#[unsafe(method_family = none)]
fn function_type(&self) -> MTLFunctionType;
}
);
pub trait MTL4BinaryFunctionExt: MTL4BinaryFunction + Message {
fn name(&self) -> Option<String> {
let s: Option<Retained<NSString>> = unsafe { msg_send![self, name] };
s.map(|v| v.to_string())
}
}
impl<T: MTL4BinaryFunction + Message> MTL4BinaryFunctionExt for T {}