objc2_core_foundation/generated/
CFUUID.rs1use core::cell::UnsafeCell;
4use core::marker::{PhantomData, PhantomPinned};
5use core::ptr::NonNull;
6#[cfg(feature = "objc2")]
7use objc2::__framework_prelude::*;
8
9use crate::*;
10
11#[repr(C)]
13pub struct CFUUID {
14 inner: [u8; 0],
15 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
16}
17
18cf_type!(
19 #[encoding_name = "__CFUUID"]
20 unsafe impl CFUUID {}
21);
22
23#[repr(C)]
25#[derive(Clone, Copy, Debug, PartialEq)]
26pub struct CFUUIDBytes {
27 pub byte0: u8,
28 pub byte1: u8,
29 pub byte2: u8,
30 pub byte3: u8,
31 pub byte4: u8,
32 pub byte5: u8,
33 pub byte6: u8,
34 pub byte7: u8,
35 pub byte8: u8,
36 pub byte9: u8,
37 pub byte10: u8,
38 pub byte11: u8,
39 pub byte12: u8,
40 pub byte13: u8,
41 pub byte14: u8,
42 pub byte15: u8,
43}
44
45#[cfg(feature = "objc2")]
46unsafe impl Encode for CFUUIDBytes {
47 const ENCODING: Encoding = Encoding::Struct(
48 "?",
49 &[
50 <u8>::ENCODING,
51 <u8>::ENCODING,
52 <u8>::ENCODING,
53 <u8>::ENCODING,
54 <u8>::ENCODING,
55 <u8>::ENCODING,
56 <u8>::ENCODING,
57 <u8>::ENCODING,
58 <u8>::ENCODING,
59 <u8>::ENCODING,
60 <u8>::ENCODING,
61 <u8>::ENCODING,
62 <u8>::ENCODING,
63 <u8>::ENCODING,
64 <u8>::ENCODING,
65 <u8>::ENCODING,
66 ],
67 );
68}
69
70#[cfg(feature = "objc2")]
71unsafe impl RefEncode for CFUUIDBytes {
72 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
73}
74
75#[cfg(feature = "CFBase")]
76unsafe impl ConcreteType for CFUUID {
77 #[doc(alias = "CFUUIDGetTypeID")]
78 #[inline]
79 fn type_id() -> CFTypeID {
80 extern "C-unwind" {
81 fn CFUUIDGetTypeID() -> CFTypeID;
82 }
83 unsafe { CFUUIDGetTypeID() }
84 }
85}
86
87#[cfg(feature = "CFBase")]
88#[inline]
89pub unsafe extern "C-unwind" fn CFUUIDCreate(
90 alloc: Option<&CFAllocator>,
91) -> Option<CFRetained<CFUUID>> {
92 extern "C-unwind" {
93 fn CFUUIDCreate(alloc: Option<&CFAllocator>) -> Option<NonNull<CFUUID>>;
94 }
95 let ret = unsafe { CFUUIDCreate(alloc) };
96 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
97}
98
99#[cfg(feature = "CFBase")]
100#[inline]
101pub unsafe extern "C-unwind" fn CFUUIDCreateWithBytes(
102 alloc: Option<&CFAllocator>,
103 byte0: u8,
104 byte1: u8,
105 byte2: u8,
106 byte3: u8,
107 byte4: u8,
108 byte5: u8,
109 byte6: u8,
110 byte7: u8,
111 byte8: u8,
112 byte9: u8,
113 byte10: u8,
114 byte11: u8,
115 byte12: u8,
116 byte13: u8,
117 byte14: u8,
118 byte15: u8,
119) -> Option<CFRetained<CFUUID>> {
120 extern "C-unwind" {
121 fn CFUUIDCreateWithBytes(
122 alloc: Option<&CFAllocator>,
123 byte0: u8,
124 byte1: u8,
125 byte2: u8,
126 byte3: u8,
127 byte4: u8,
128 byte5: u8,
129 byte6: u8,
130 byte7: u8,
131 byte8: u8,
132 byte9: u8,
133 byte10: u8,
134 byte11: u8,
135 byte12: u8,
136 byte13: u8,
137 byte14: u8,
138 byte15: u8,
139 ) -> Option<NonNull<CFUUID>>;
140 }
141 let ret = unsafe {
142 CFUUIDCreateWithBytes(
143 alloc, byte0, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8, byte9, byte10,
144 byte11, byte12, byte13, byte14, byte15,
145 )
146 };
147 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
148}
149
150#[cfg(feature = "CFBase")]
151#[inline]
152pub unsafe extern "C-unwind" fn CFUUIDCreateFromString(
153 alloc: Option<&CFAllocator>,
154 uuid_str: Option<&CFString>,
155) -> Option<CFRetained<CFUUID>> {
156 extern "C-unwind" {
157 fn CFUUIDCreateFromString(
158 alloc: Option<&CFAllocator>,
159 uuid_str: Option<&CFString>,
160 ) -> Option<NonNull<CFUUID>>;
161 }
162 let ret = unsafe { CFUUIDCreateFromString(alloc, uuid_str) };
163 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
164}
165
166#[cfg(feature = "CFBase")]
167#[inline]
168pub unsafe extern "C-unwind" fn CFUUIDCreateString(
169 alloc: Option<&CFAllocator>,
170 uuid: Option<&CFUUID>,
171) -> Option<CFRetained<CFString>> {
172 extern "C-unwind" {
173 fn CFUUIDCreateString(
174 alloc: Option<&CFAllocator>,
175 uuid: Option<&CFUUID>,
176 ) -> Option<NonNull<CFString>>;
177 }
178 let ret = unsafe { CFUUIDCreateString(alloc, uuid) };
179 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
180}
181
182#[cfg(feature = "CFBase")]
183#[inline]
184pub unsafe extern "C-unwind" fn CFUUIDGetConstantUUIDWithBytes(
185 alloc: Option<&CFAllocator>,
186 byte0: u8,
187 byte1: u8,
188 byte2: u8,
189 byte3: u8,
190 byte4: u8,
191 byte5: u8,
192 byte6: u8,
193 byte7: u8,
194 byte8: u8,
195 byte9: u8,
196 byte10: u8,
197 byte11: u8,
198 byte12: u8,
199 byte13: u8,
200 byte14: u8,
201 byte15: u8,
202) -> Option<CFRetained<CFUUID>> {
203 extern "C-unwind" {
204 fn CFUUIDGetConstantUUIDWithBytes(
205 alloc: Option<&CFAllocator>,
206 byte0: u8,
207 byte1: u8,
208 byte2: u8,
209 byte3: u8,
210 byte4: u8,
211 byte5: u8,
212 byte6: u8,
213 byte7: u8,
214 byte8: u8,
215 byte9: u8,
216 byte10: u8,
217 byte11: u8,
218 byte12: u8,
219 byte13: u8,
220 byte14: u8,
221 byte15: u8,
222 ) -> Option<NonNull<CFUUID>>;
223 }
224 let ret = unsafe {
225 CFUUIDGetConstantUUIDWithBytes(
226 alloc, byte0, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8, byte9, byte10,
227 byte11, byte12, byte13, byte14, byte15,
228 )
229 };
230 ret.map(|ret| unsafe { CFRetained::retain(ret) })
231}
232
233extern "C-unwind" {
234 pub fn CFUUIDGetUUIDBytes(uuid: &CFUUID) -> CFUUIDBytes;
235}
236
237#[cfg(feature = "CFBase")]
238#[inline]
239pub unsafe extern "C-unwind" fn CFUUIDCreateFromUUIDBytes(
240 alloc: Option<&CFAllocator>,
241 bytes: CFUUIDBytes,
242) -> Option<CFRetained<CFUUID>> {
243 extern "C-unwind" {
244 fn CFUUIDCreateFromUUIDBytes(
245 alloc: Option<&CFAllocator>,
246 bytes: CFUUIDBytes,
247 ) -> Option<NonNull<CFUUID>>;
248 }
249 let ret = unsafe { CFUUIDCreateFromUUIDBytes(alloc, bytes) };
250 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
251}