objc2_metal/generated/
MTL4LibraryDescriptor.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    /// Serves as the base descriptor for creating a Metal library.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4librarydescriptor?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct MTL4LibraryDescriptor;
17);
18
19extern_conformance!(
20    unsafe impl NSCopying for MTL4LibraryDescriptor {}
21);
22
23unsafe impl CopyingHelper for MTL4LibraryDescriptor {
24    type Result = Self;
25}
26
27extern_conformance!(
28    unsafe impl NSObjectProtocol for MTL4LibraryDescriptor {}
29);
30
31impl MTL4LibraryDescriptor {
32    extern_methods!(
33        /// Assigns an optional string containing the source code of the shader language program to compile into a
34        /// Metal library.
35        #[unsafe(method(source))]
36        #[unsafe(method_family = none)]
37        pub fn source(&self) -> Option<Retained<NSString>>;
38
39        /// Setter for [`source`][Self::source].
40        ///
41        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
42        #[unsafe(method(setSource:))]
43        #[unsafe(method_family = none)]
44        pub fn setSource(&self, source: Option<&NSString>);
45
46        #[cfg(feature = "MTLLibrary")]
47        /// Provides compile-time options for the Metal library.
48        #[unsafe(method(options))]
49        #[unsafe(method_family = none)]
50        pub fn options(&self) -> Option<Retained<MTLCompileOptions>>;
51
52        #[cfg(feature = "MTLLibrary")]
53        /// Setter for [`options`][Self::options].
54        ///
55        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
56        #[unsafe(method(setOptions:))]
57        #[unsafe(method_family = none)]
58        pub fn setOptions(&self, options: Option<&MTLCompileOptions>);
59
60        /// Assigns an optional name to the Metal library.
61        #[unsafe(method(name))]
62        #[unsafe(method_family = none)]
63        pub fn name(&self) -> Option<Retained<NSString>>;
64
65        /// Setter for [`name`][Self::name].
66        ///
67        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
68        #[unsafe(method(setName:))]
69        #[unsafe(method_family = none)]
70        pub fn setName(&self, name: Option<&NSString>);
71    );
72}
73
74/// Methods declared on superclass `NSObject`.
75impl MTL4LibraryDescriptor {
76    extern_methods!(
77        #[unsafe(method(init))]
78        #[unsafe(method_family = init)]
79        pub fn init(this: Allocated<Self>) -> Retained<Self>;
80
81        #[unsafe(method(new))]
82        #[unsafe(method_family = new)]
83        pub fn new() -> Retained<Self>;
84    );
85}
86
87impl DefaultRetained for MTL4LibraryDescriptor {
88    #[inline]
89    fn default_retained() -> Retained<Self> {
90        Self::new()
91    }
92}