objc2-metal 0.3.2

Bindings to the Metal framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// Describes a shader function from a Metal library.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4libraryfunctiondescriptor?language=objc)
    #[unsafe(super(MTL4FunctionDescriptor, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "MTL4FunctionDescriptor")]
    pub struct MTL4LibraryFunctionDescriptor;
);

#[cfg(feature = "MTL4FunctionDescriptor")]
extern_conformance!(
    unsafe impl NSCopying for MTL4LibraryFunctionDescriptor {}
);

#[cfg(feature = "MTL4FunctionDescriptor")]
unsafe impl CopyingHelper for MTL4LibraryFunctionDescriptor {
    type Result = Self;
}

#[cfg(feature = "MTL4FunctionDescriptor")]
extern_conformance!(
    unsafe impl NSObjectProtocol for MTL4LibraryFunctionDescriptor {}
);

#[cfg(feature = "MTL4FunctionDescriptor")]
impl MTL4LibraryFunctionDescriptor {
    extern_methods!(
        /// Assigns a name to the function.
        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub fn name(&self) -> Option<Retained<NSString>>;

        /// Setter for [`name`][Self::name].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setName:))]
        #[unsafe(method_family = none)]
        pub fn setName(&self, name: Option<&NSString>);

        #[cfg(feature = "MTLLibrary")]
        /// Returns a reference to the library containing the function.
        #[unsafe(method(library))]
        #[unsafe(method_family = none)]
        pub fn library(&self) -> Option<Retained<ProtocolObject<dyn MTLLibrary>>>;

        #[cfg(feature = "MTLLibrary")]
        /// Setter for [`library`][Self::library].
        #[unsafe(method(setLibrary:))]
        #[unsafe(method_family = none)]
        pub fn setLibrary(&self, library: Option<&ProtocolObject<dyn MTLLibrary>>);
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "MTL4FunctionDescriptor")]
impl MTL4LibraryFunctionDescriptor {
    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>;
    );
}

#[cfg(feature = "MTL4FunctionDescriptor")]
impl DefaultRetained for MTL4LibraryFunctionDescriptor {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}