objc2_core_media/generated/
CMSimpleQueue.rs1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10
11use crate::*;
12
13pub const kCMSimpleQueueError_AllocationFailed: OSStatus = -12770;
15pub const kCMSimpleQueueError_RequiredParameterMissing: OSStatus = -12771;
17pub const kCMSimpleQueueError_ParameterOutOfRange: OSStatus = -12772;
19pub const kCMSimpleQueueError_QueueIsFull: OSStatus = -12773;
21
22#[doc(alias = "CMSimpleQueueRef")]
26#[repr(C)]
27pub struct CMSimpleQueue {
28 inner: [u8; 0],
29 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
30}
31
32cf_type!(
33 unsafe impl CMSimpleQueue {}
34);
35#[cfg(feature = "objc2")]
36cf_objc2_type!(
37 unsafe impl RefEncode<"opaqueCMSimpleQueue"> for CMSimpleQueue {}
38);
39
40unsafe impl ConcreteType for CMSimpleQueue {
41 #[doc(alias = "CMSimpleQueueGetTypeID")]
48 #[inline]
49 fn type_id() -> CFTypeID {
50 extern "C-unwind" {
51 fn CMSimpleQueueGetTypeID() -> CFTypeID;
52 }
53 unsafe { CMSimpleQueueGetTypeID() }
54 }
55}
56
57impl CMSimpleQueue {
58 #[doc(alias = "CMSimpleQueueCreate")]
69 #[inline]
70 pub unsafe fn create(
71 allocator: Option<&CFAllocator>,
72 capacity: i32,
73 queue_out: NonNull<*mut CMSimpleQueue>,
74 ) -> OSStatus {
75 extern "C-unwind" {
76 fn CMSimpleQueueCreate(
77 allocator: Option<&CFAllocator>,
78 capacity: i32,
79 queue_out: NonNull<*mut CMSimpleQueue>,
80 ) -> OSStatus;
81 }
82 unsafe { CMSimpleQueueCreate(allocator, capacity, queue_out) }
83 }
84
85 #[doc(alias = "CMSimpleQueueEnqueue")]
95 #[inline]
96 pub unsafe fn enqueue(&self, element: NonNull<c_void>) -> OSStatus {
97 extern "C-unwind" {
98 fn CMSimpleQueueEnqueue(queue: &CMSimpleQueue, element: NonNull<c_void>) -> OSStatus;
99 }
100 unsafe { CMSimpleQueueEnqueue(self, element) }
101 }
102
103 #[doc(alias = "CMSimpleQueueDequeue")]
109 #[inline]
110 pub unsafe fn dequeue(&self) -> *const c_void {
111 extern "C-unwind" {
112 fn CMSimpleQueueDequeue(queue: &CMSimpleQueue) -> *const c_void;
113 }
114 unsafe { CMSimpleQueueDequeue(self) }
115 }
116
117 #[doc(alias = "CMSimpleQueueGetHead")]
123 #[inline]
124 pub unsafe fn head(&self) -> *const c_void {
125 extern "C-unwind" {
126 fn CMSimpleQueueGetHead(queue: &CMSimpleQueue) -> *const c_void;
127 }
128 unsafe { CMSimpleQueueGetHead(self) }
129 }
130
131 #[doc(alias = "CMSimpleQueueReset")]
140 #[inline]
141 pub unsafe fn reset(&self) -> OSStatus {
142 extern "C-unwind" {
143 fn CMSimpleQueueReset(queue: &CMSimpleQueue) -> OSStatus;
144 }
145 unsafe { CMSimpleQueueReset(self) }
146 }
147
148 #[doc(alias = "CMSimpleQueueGetCapacity")]
153 #[inline]
154 pub unsafe fn capacity(&self) -> i32 {
155 extern "C-unwind" {
156 fn CMSimpleQueueGetCapacity(queue: &CMSimpleQueue) -> i32;
157 }
158 unsafe { CMSimpleQueueGetCapacity(self) }
159 }
160
161 #[doc(alias = "CMSimpleQueueGetCount")]
165 #[inline]
166 pub unsafe fn count(&self) -> i32 {
167 extern "C-unwind" {
168 fn CMSimpleQueueGetCount(queue: &CMSimpleQueue) -> i32;
169 }
170 unsafe { CMSimpleQueueGetCount(self) }
171 }
172}
173
174extern "C-unwind" {
175 #[deprecated = "renamed to `CMSimpleQueue::create`"]
176 pub fn CMSimpleQueueCreate(
177 allocator: Option<&CFAllocator>,
178 capacity: i32,
179 queue_out: NonNull<*mut CMSimpleQueue>,
180 ) -> OSStatus;
181}
182
183extern "C-unwind" {
184 #[deprecated = "renamed to `CMSimpleQueue::enqueue`"]
185 pub fn CMSimpleQueueEnqueue(queue: &CMSimpleQueue, element: NonNull<c_void>) -> OSStatus;
186}
187
188extern "C-unwind" {
189 #[deprecated = "renamed to `CMSimpleQueue::dequeue`"]
190 pub fn CMSimpleQueueDequeue(queue: &CMSimpleQueue) -> *const c_void;
191}
192
193extern "C-unwind" {
194 #[deprecated = "renamed to `CMSimpleQueue::head`"]
195 pub fn CMSimpleQueueGetHead(queue: &CMSimpleQueue) -> *const c_void;
196}
197
198extern "C-unwind" {
199 #[deprecated = "renamed to `CMSimpleQueue::reset`"]
200 pub fn CMSimpleQueueReset(queue: &CMSimpleQueue) -> OSStatus;
201}
202
203extern "C-unwind" {
204 #[deprecated = "renamed to `CMSimpleQueue::capacity`"]
205 pub fn CMSimpleQueueGetCapacity(queue: &CMSimpleQueue) -> i32;
206}
207
208extern "C-unwind" {
209 #[deprecated = "renamed to `CMSimpleQueue::count`"]
210 pub fn CMSimpleQueueGetCount(queue: &CMSimpleQueue) -> i32;
211}