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!(
    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlvisiblefunctiontabledescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTLVisibleFunctionTableDescriptor;
);

extern_conformance!(
    unsafe impl NSCopying for MTLVisibleFunctionTableDescriptor {}
);

unsafe impl CopyingHelper for MTLVisibleFunctionTableDescriptor {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for MTLVisibleFunctionTableDescriptor {}
);

impl MTLVisibleFunctionTableDescriptor {
    extern_methods!(
        /// Create an autoreleased visible function table descriptor
        #[unsafe(method(visibleFunctionTableDescriptor))]
        #[unsafe(method_family = none)]
        pub fn visibleFunctionTableDescriptor() -> Retained<MTLVisibleFunctionTableDescriptor>;

        /// The number of functions in the table.
        #[unsafe(method(functionCount))]
        #[unsafe(method_family = none)]
        pub fn functionCount(&self) -> NSUInteger;

        /// Setter for [`functionCount`][Self::functionCount].
        ///
        /// # Safety
        ///
        /// This might not be bounds-checked.
        #[unsafe(method(setFunctionCount:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFunctionCount(&self, function_count: NSUInteger);
    );
}

/// Methods declared on superclass `NSObject`.
impl MTLVisibleFunctionTableDescriptor {
    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>;
    );
}

impl DefaultRetained for MTLVisibleFunctionTableDescriptor {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlvisiblefunctiontable?language=objc)
    #[cfg(all(feature = "MTLAllocation", feature = "MTLResource"))]
    pub unsafe trait MTLVisibleFunctionTable: MTLResource {
        #[cfg(feature = "MTLTypes")]
        /// Handle of the GPU resource suitable for storing in an Argument Buffer
        #[unsafe(method(gpuResourceID))]
        #[unsafe(method_family = none)]
        fn gpuResourceID(&self) -> MTLResourceID;

        #[cfg(feature = "MTLFunctionHandle")]
        /// # Safety
        ///
        /// - `function` must be safe to call.
        /// - `function` must have the correct argument and return types.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setFunction:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setFunction_atIndex(
            &self,
            function: Option<&ProtocolObject<dyn MTLFunctionHandle>>,
            index: NSUInteger,
        );

        #[cfg(feature = "MTLFunctionHandle")]
        /// # Safety
        ///
        /// - `functions` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setFunctions:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setFunctions_withRange(
            &self,
            functions: NonNull<*const ProtocolObject<dyn MTLFunctionHandle>>,
            range: NSRange,
        );
    }
);