objc2_metal/generated/
MTLVisibleFunctionTable.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    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlvisiblefunctiontabledescriptor?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct MTLVisibleFunctionTableDescriptor;
15);
16
17extern_conformance!(
18    unsafe impl NSCopying for MTLVisibleFunctionTableDescriptor {}
19);
20
21unsafe impl CopyingHelper for MTLVisibleFunctionTableDescriptor {
22    type Result = Self;
23}
24
25extern_conformance!(
26    unsafe impl NSObjectProtocol for MTLVisibleFunctionTableDescriptor {}
27);
28
29impl MTLVisibleFunctionTableDescriptor {
30    extern_methods!(
31        /// Create an autoreleased visible function table descriptor
32        #[unsafe(method(visibleFunctionTableDescriptor))]
33        #[unsafe(method_family = none)]
34        pub fn visibleFunctionTableDescriptor() -> Retained<MTLVisibleFunctionTableDescriptor>;
35
36        /// The number of functions in the table.
37        #[unsafe(method(functionCount))]
38        #[unsafe(method_family = none)]
39        pub fn functionCount(&self) -> NSUInteger;
40
41        /// Setter for [`functionCount`][Self::functionCount].
42        ///
43        /// # Safety
44        ///
45        /// This might not be bounds-checked.
46        #[unsafe(method(setFunctionCount:))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn setFunctionCount(&self, function_count: NSUInteger);
49    );
50}
51
52/// Methods declared on superclass `NSObject`.
53impl MTLVisibleFunctionTableDescriptor {
54    extern_methods!(
55        #[unsafe(method(init))]
56        #[unsafe(method_family = init)]
57        pub fn init(this: Allocated<Self>) -> Retained<Self>;
58
59        #[unsafe(method(new))]
60        #[unsafe(method_family = new)]
61        pub fn new() -> Retained<Self>;
62    );
63}
64
65impl DefaultRetained for MTLVisibleFunctionTableDescriptor {
66    #[inline]
67    fn default_retained() -> Retained<Self> {
68        Self::new()
69    }
70}
71
72extern_protocol!(
73    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlvisiblefunctiontable?language=objc)
74    #[cfg(all(feature = "MTLAllocation", feature = "MTLResource"))]
75    pub unsafe trait MTLVisibleFunctionTable: MTLResource {
76        #[cfg(feature = "MTLTypes")]
77        /// Handle of the GPU resource suitable for storing in an Argument Buffer
78        #[unsafe(method(gpuResourceID))]
79        #[unsafe(method_family = none)]
80        fn gpuResourceID(&self) -> MTLResourceID;
81
82        #[cfg(feature = "MTLFunctionHandle")]
83        /// # Safety
84        ///
85        /// - `function` must be safe to call.
86        /// - `function` must have the correct argument and return types.
87        /// - `index` might not be bounds-checked.
88        #[unsafe(method(setFunction:atIndex:))]
89        #[unsafe(method_family = none)]
90        unsafe fn setFunction_atIndex(
91            &self,
92            function: Option<&ProtocolObject<dyn MTLFunctionHandle>>,
93            index: NSUInteger,
94        );
95
96        #[cfg(feature = "MTLFunctionHandle")]
97        /// # Safety
98        ///
99        /// - `functions` must be a valid pointer.
100        /// - `range` might not be bounds-checked.
101        #[unsafe(method(setFunctions:withRange:))]
102        #[unsafe(method_family = none)]
103        unsafe fn setFunctions_withRange(
104            &self,
105            functions: NonNull<*const ProtocolObject<dyn MTLFunctionHandle>>,
106            range: NSRange,
107        );
108    }
109);