objc2_metal/generated/
MTL4CompilerTask.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::*;
6
7use crate::*;
8
9/// Represents the status of a compiler task.
10///
11/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4compilertaskstatus?language=objc)
12// NS_ENUM
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct MTL4CompilerTaskStatus(pub NSInteger);
16impl MTL4CompilerTaskStatus {
17    /// No status.
18    #[doc(alias = "MTL4CompilerTaskStatusNone")]
19    pub const None: Self = Self(0);
20    /// The compiler task is currently scheduled.
21    #[doc(alias = "MTL4CompilerTaskStatusScheduled")]
22    pub const Scheduled: Self = Self(1);
23    /// The compiler task is currently compiling.
24    #[doc(alias = "MTL4CompilerTaskStatusCompiling")]
25    pub const Compiling: Self = Self(2);
26    /// The compiler task is finished.
27    #[doc(alias = "MTL4CompilerTaskStatusFinished")]
28    pub const Finished: Self = Self(3);
29}
30
31unsafe impl Encode for MTL4CompilerTaskStatus {
32    const ENCODING: Encoding = NSInteger::ENCODING;
33}
34
35unsafe impl RefEncode for MTL4CompilerTaskStatus {
36    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39extern_protocol!(
40    /// A reference to an asynchronous compilation task that you initiate from a compiler instance.
41    ///
42    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4compilertask?language=objc)
43    pub unsafe trait MTL4CompilerTask: NSObjectProtocol {
44        #[cfg(feature = "MTL4Compiler")]
45        /// Returns the compiler instance that this asynchronous compiler task belongs to.
46        #[unsafe(method(compiler))]
47        #[unsafe(method_family = none)]
48        fn compiler(&self) -> Retained<ProtocolObject<dyn MTL4Compiler>>;
49
50        /// Returns the compiler task status.
51        ///
52        /// The default is `MTL4CompilerStatusNone`.
53        #[unsafe(method(status))]
54        #[unsafe(method_family = none)]
55        fn status(&self) -> MTL4CompilerTaskStatus;
56
57        /// Waits synchronously for this compile task to complete by blocking the calling thread.
58        #[unsafe(method(waitUntilCompleted))]
59        #[unsafe(method_family = none)]
60        fn waitUntilCompleted(&self);
61    }
62);