objc2_metal/generated/
MTLLogState.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct MTLLogLevel(pub NSInteger);
17impl MTLLogLevel {
18 #[doc(alias = "MTLLogLevelUndefined")]
19 pub const Undefined: Self = Self(0);
20 #[doc(alias = "MTLLogLevelDebug")]
21 pub const Debug: Self = Self(1);
22 #[doc(alias = "MTLLogLevelInfo")]
23 pub const Info: Self = Self(2);
24 #[doc(alias = "MTLLogLevelNotice")]
25 pub const Notice: Self = Self(3);
26 #[doc(alias = "MTLLogLevelError")]
27 pub const Error: Self = Self(4);
28 #[doc(alias = "MTLLogLevelFault")]
29 pub const Fault: Self = Self(5);
30}
31
32unsafe impl Encode for MTLLogLevel {
33 const ENCODING: Encoding = NSInteger::ENCODING;
34}
35
36unsafe impl RefEncode for MTLLogLevel {
37 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern_protocol!(
41 pub unsafe trait MTLLogState: NSObjectProtocol + Send + Sync {
43 #[cfg(feature = "block2")]
44 #[unsafe(method(addLogHandler:))]
51 #[unsafe(method_family = none)]
52 unsafe fn addLogHandler(
53 &self,
54 block: &block2::DynBlock<
55 dyn Fn(*mut NSString, *mut NSString, MTLLogLevel, NonNull<NSString>),
56 >,
57 );
58 }
59);
60
61extern_class!(
62 #[unsafe(super(NSObject))]
64 #[derive(Debug, PartialEq, Eq, Hash)]
65 pub struct MTLLogStateDescriptor;
66);
67
68extern_conformance!(
69 unsafe impl NSCopying for MTLLogStateDescriptor {}
70);
71
72unsafe impl CopyingHelper for MTLLogStateDescriptor {
73 type Result = Self;
74}
75
76extern_conformance!(
77 unsafe impl NSObjectProtocol for MTLLogStateDescriptor {}
78);
79
80impl MTLLogStateDescriptor {
81 extern_methods!(
82 #[unsafe(method(level))]
86 #[unsafe(method_family = none)]
87 pub fn level(&self) -> MTLLogLevel;
88
89 #[unsafe(method(setLevel:))]
91 #[unsafe(method_family = none)]
92 pub fn setLevel(&self, level: MTLLogLevel);
93
94 #[unsafe(method(bufferSize))]
96 #[unsafe(method_family = none)]
97 pub fn bufferSize(&self) -> NSInteger;
98
99 #[unsafe(method(setBufferSize:))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn setBufferSize(&self, buffer_size: NSInteger);
107 );
108}
109
110impl MTLLogStateDescriptor {
112 extern_methods!(
113 #[unsafe(method(init))]
114 #[unsafe(method_family = init)]
115 pub fn init(this: Allocated<Self>) -> Retained<Self>;
116
117 #[unsafe(method(new))]
118 #[unsafe(method_family = new)]
119 pub fn new() -> Retained<Self>;
120 );
121}
122
123impl DefaultRetained for MTLLogStateDescriptor {
124 #[inline]
125 fn default_retained() -> Retained<Self> {
126 Self::new()
127 }
128}
129
130extern "C" {
131 pub static MTLLogStateErrorDomain: &'static NSErrorDomain;
133}
134
135#[repr(transparent)]
140#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
141pub struct MTLLogStateError(pub NSUInteger);
142impl MTLLogStateError {
143 #[doc(alias = "MTLLogStateErrorInvalidSize")]
144 pub const InvalidSize: Self = Self(1);
145 #[doc(alias = "MTLLogStateErrorInvalid")]
146 pub const Invalid: Self = Self(2);
147}
148
149unsafe impl Encode for MTLLogStateError {
150 const ENCODING: Encoding = NSUInteger::ENCODING;
151}
152
153unsafe impl RefEncode for MTLLogStateError {
154 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
155}