objc2_metal/generated/
MTL4LibraryFunctionDescriptor.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// Describes a shader function from a Metal library.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4libraryfunctiondescriptor?language=objc)
14    #[unsafe(super(MTL4FunctionDescriptor, NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    #[cfg(feature = "MTL4FunctionDescriptor")]
17    pub struct MTL4LibraryFunctionDescriptor;
18);
19
20#[cfg(feature = "MTL4FunctionDescriptor")]
21extern_conformance!(
22    unsafe impl NSCopying for MTL4LibraryFunctionDescriptor {}
23);
24
25#[cfg(feature = "MTL4FunctionDescriptor")]
26unsafe impl CopyingHelper for MTL4LibraryFunctionDescriptor {
27    type Result = Self;
28}
29
30#[cfg(feature = "MTL4FunctionDescriptor")]
31extern_conformance!(
32    unsafe impl NSObjectProtocol for MTL4LibraryFunctionDescriptor {}
33);
34
35#[cfg(feature = "MTL4FunctionDescriptor")]
36impl MTL4LibraryFunctionDescriptor {
37    extern_methods!(
38        /// Assigns a name to the function.
39        #[unsafe(method(name))]
40        #[unsafe(method_family = none)]
41        pub fn name(&self) -> Option<Retained<NSString>>;
42
43        /// Setter for [`name`][Self::name].
44        ///
45        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
46        #[unsafe(method(setName:))]
47        #[unsafe(method_family = none)]
48        pub fn setName(&self, name: Option<&NSString>);
49
50        #[cfg(feature = "MTLLibrary")]
51        /// Returns a reference to the library containing the function.
52        #[unsafe(method(library))]
53        #[unsafe(method_family = none)]
54        pub fn library(&self) -> Option<Retained<ProtocolObject<dyn MTLLibrary>>>;
55
56        #[cfg(feature = "MTLLibrary")]
57        /// Setter for [`library`][Self::library].
58        #[unsafe(method(setLibrary:))]
59        #[unsafe(method_family = none)]
60        pub fn setLibrary(&self, library: Option<&ProtocolObject<dyn MTLLibrary>>);
61    );
62}
63
64/// Methods declared on superclass `NSObject`.
65#[cfg(feature = "MTL4FunctionDescriptor")]
66impl MTL4LibraryFunctionDescriptor {
67    extern_methods!(
68        #[unsafe(method(init))]
69        #[unsafe(method_family = init)]
70        pub fn init(this: Allocated<Self>) -> Retained<Self>;
71
72        #[unsafe(method(new))]
73        #[unsafe(method_family = new)]
74        pub fn new() -> Retained<Self>;
75    );
76}
77
78#[cfg(feature = "MTL4FunctionDescriptor")]
79impl DefaultRetained for MTL4LibraryFunctionDescriptor {
80    #[inline]
81    fn default_retained() -> Retained<Self> {
82        Self::new()
83    }
84}