use crate::common::*;
use crate::Foundation::*;
use crate::Metal::*;
extern_static!(MTLBinaryArchiveDomain: &'static NSErrorDomain);
ns_enum!(
#[underlying(NSUInteger)]
pub enum MTLBinaryArchiveError {
MTLBinaryArchiveErrorNone = 0,
MTLBinaryArchiveErrorInvalidFile = 1,
MTLBinaryArchiveErrorUnexpectedElement = 2,
MTLBinaryArchiveErrorCompilationFailure = 3,
MTLBinaryArchiveErrorInternalError = 4,
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "Metal_MTLBinaryArchiveDescriptor")]
pub struct MTLBinaryArchiveDescriptor;
#[cfg(feature = "Metal_MTLBinaryArchiveDescriptor")]
unsafe impl ClassType for MTLBinaryArchiveDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "Metal_MTLBinaryArchiveDescriptor")]
unsafe impl NSCopying for MTLBinaryArchiveDescriptor {}
#[cfg(feature = "Metal_MTLBinaryArchiveDescriptor")]
unsafe impl NSObjectProtocol for MTLBinaryArchiveDescriptor {}
extern_methods!(
#[cfg(feature = "Metal_MTLBinaryArchiveDescriptor")]
unsafe impl MTLBinaryArchiveDescriptor {
#[cfg(feature = "Foundation_NSURL")]
#[method_id(@__retain_semantics Other url)]
pub fn url(&self) -> Option<Id<NSURL>>;
#[cfg(feature = "Foundation_NSURL")]
#[method(setUrl:)]
pub fn setUrl(&self, url: Option<&NSURL>);
}
);
extern_methods!(
#[cfg(feature = "Metal_MTLBinaryArchiveDescriptor")]
unsafe impl MTLBinaryArchiveDescriptor {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Id<Self>;
}
);
#[cfg(feature = "Metal_MTLBinaryArchiveDescriptor")]
impl DefaultId for MTLBinaryArchiveDescriptor {
#[inline]
fn default_id() -> Id<Self> {
Self::new()
}
}
extern_protocol!(
pub unsafe trait MTLBinaryArchive: NSObjectProtocol {
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other label)]
fn label(&self) -> Option<Id<NSString>>;
#[cfg(feature = "Foundation_NSString")]
#[method(setLabel:)]
fn setLabel(&self, label: Option<&NSString>);
#[method_id(@__retain_semantics Other device)]
fn device(&self) -> Id<ProtocolObject<dyn MTLDevice>>;
#[cfg(all(
feature = "Foundation_NSError",
feature = "Metal_MTLComputePipelineDescriptor"
))]
#[method(addComputePipelineFunctionsWithDescriptor:error:_)]
fn addComputePipelineFunctionsWithDescriptor_error(
&self,
descriptor: &MTLComputePipelineDescriptor,
) -> Result<(), Id<NSError>>;
#[cfg(all(
feature = "Foundation_NSError",
feature = "Metal_MTLRenderPipelineDescriptor"
))]
#[method(addRenderPipelineFunctionsWithDescriptor:error:_)]
fn addRenderPipelineFunctionsWithDescriptor_error(
&self,
descriptor: &MTLRenderPipelineDescriptor,
) -> Result<(), Id<NSError>>;
#[cfg(all(
feature = "Foundation_NSError",
feature = "Metal_MTLTileRenderPipelineDescriptor"
))]
#[method(addTileRenderPipelineFunctionsWithDescriptor:error:_)]
unsafe fn addTileRenderPipelineFunctionsWithDescriptor_error(
&self,
descriptor: &MTLTileRenderPipelineDescriptor,
) -> Result<(), Id<NSError>>;
#[cfg(all(feature = "Foundation_NSError", feature = "Foundation_NSURL"))]
#[method(serializeToURL:error:_)]
fn serializeToURL_error(&self, url: &NSURL) -> Result<(), Id<NSError>>;
#[cfg(all(
feature = "Foundation_NSError",
feature = "Metal_MTLFunctionDescriptor"
))]
#[method(addFunctionWithDescriptor:library:error:_)]
unsafe fn addFunctionWithDescriptor_library_error(
&self,
descriptor: &MTLFunctionDescriptor,
library: &ProtocolObject<dyn MTLLibrary>,
) -> Result<(), Id<NSError>>;
}
unsafe impl ProtocolType for dyn MTLBinaryArchive {}
);