objc2_metal/generated/
MTL4CommandAllocator.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    /// Groups together parameters for creating a command allocator.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4commandallocatordescriptor?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct MTL4CommandAllocatorDescriptor;
17);
18
19extern_conformance!(
20    unsafe impl NSCopying for MTL4CommandAllocatorDescriptor {}
21);
22
23unsafe impl CopyingHelper for MTL4CommandAllocatorDescriptor {
24    type Result = Self;
25}
26
27extern_conformance!(
28    unsafe impl NSObjectProtocol for MTL4CommandAllocatorDescriptor {}
29);
30
31impl MTL4CommandAllocatorDescriptor {
32    extern_methods!(
33        /// An optional label you can assign to the command allocator to aid debugging.
34        #[unsafe(method(label))]
35        #[unsafe(method_family = none)]
36        pub fn label(&self) -> Option<Retained<NSString>>;
37
38        /// Setter for [`label`][Self::label].
39        ///
40        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
41        #[unsafe(method(setLabel:))]
42        #[unsafe(method_family = none)]
43        pub fn setLabel(&self, label: Option<&NSString>);
44    );
45}
46
47/// Methods declared on superclass `NSObject`.
48impl MTL4CommandAllocatorDescriptor {
49    extern_methods!(
50        #[unsafe(method(init))]
51        #[unsafe(method_family = init)]
52        pub fn init(this: Allocated<Self>) -> Retained<Self>;
53
54        #[unsafe(method(new))]
55        #[unsafe(method_family = new)]
56        pub fn new() -> Retained<Self>;
57    );
58}
59
60impl DefaultRetained for MTL4CommandAllocatorDescriptor {
61    #[inline]
62    fn default_retained() -> Retained<Self> {
63        Self::new()
64    }
65}
66
67extern_protocol!(
68    /// Manages the memory backing the encoding of GPU commands into command buffers.
69    ///
70    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4commandallocator?language=objc)
71    pub unsafe trait MTL4CommandAllocator: NSObjectProtocol {
72        #[cfg(feature = "MTLDevice")]
73        /// Returns the GPU device that this command allocator belongs to.
74        #[unsafe(method(device))]
75        #[unsafe(method_family = none)]
76        fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
77
78        /// Provides the optional label you specify at creation time for debug purposes.
79        #[unsafe(method(label))]
80        #[unsafe(method_family = none)]
81        fn label(&self) -> Option<Retained<NSString>>;
82
83        /// Queries the size of the internal memory heaps of this command allocator that support encoding
84        /// commands into command buffers.
85        ///
86        /// - Returns: a size in bytes.
87        #[unsafe(method(allocatedSize))]
88        #[unsafe(method_family = none)]
89        fn allocatedSize(&self) -> u64;
90
91        /// Marks the command allocator's heaps for reuse.
92        ///
93        /// Calling this method allows new ``MTL4CommandBuffer`` to reuse its existing internal
94        /// memory heaps to encode new GPU commands.
95        ///
96        /// You are responsible to ensure that all command buffers with memory originating
97        /// from this allocator instance are complete before calling resetting it.
98        #[unsafe(method(reset))]
99        #[unsafe(method_family = none)]
100        fn reset(&self);
101    }
102);