objc2_foundation/generated/
NSZone.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[inline]
10pub extern "C-unwind" fn NSDefaultMallocZone() -> NonNull<NSZone> {
11 extern "C-unwind" {
12 fn NSDefaultMallocZone() -> Option<NonNull<NSZone>>;
13 }
14 let ret = unsafe { NSDefaultMallocZone() };
15 ret.expect("function was marked as returning non-null, but actually returned NULL")
16}
17
18#[inline]
19pub extern "C-unwind" fn NSCreateZone(
20 start_size: NSUInteger,
21 granularity: NSUInteger,
22 can_free: bool,
23) -> NonNull<NSZone> {
24 extern "C-unwind" {
25 fn NSCreateZone(
26 start_size: NSUInteger,
27 granularity: NSUInteger,
28 can_free: Bool,
29 ) -> Option<NonNull<NSZone>>;
30 }
31 let ret = unsafe { NSCreateZone(start_size, granularity, Bool::new(can_free)) };
32 ret.expect("function was marked as returning non-null, but actually returned NULL")
33}
34
35extern "C-unwind" {
36 pub fn NSRecycleZone(zone: NonNull<NSZone>);
40}
41
42extern "C-unwind" {
43 #[cfg(feature = "NSString")]
47 pub fn NSSetZoneName(zone: *mut NSZone, name: &NSString);
48}
49
50#[cfg(feature = "NSString")]
54#[inline]
55pub unsafe extern "C-unwind" fn NSZoneName(zone: *mut NSZone) -> Retained<NSString> {
56 extern "C-unwind" {
57 fn NSZoneName(zone: *mut NSZone) -> *mut NSString;
58 }
59 let ret = unsafe { NSZoneName(zone) };
60 unsafe { Retained::retain_autoreleased(ret) }
61 .expect("function was marked as returning non-null, but actually returned NULL")
62}
63
64extern "C-unwind" {
65 pub fn NSZoneFromPointer(ptr: NonNull<c_void>) -> *mut NSZone;
69}
70
71#[inline]
75pub unsafe extern "C-unwind" fn NSZoneMalloc(
76 zone: *mut NSZone,
77 size: NSUInteger,
78) -> NonNull<c_void> {
79 extern "C-unwind" {
80 fn NSZoneMalloc(zone: *mut NSZone, size: NSUInteger) -> Option<NonNull<c_void>>;
81 }
82 let ret = unsafe { NSZoneMalloc(zone, size) };
83 ret.expect("function was marked as returning non-null, but actually returned NULL")
84}
85
86#[inline]
90pub unsafe extern "C-unwind" fn NSZoneCalloc(
91 zone: *mut NSZone,
92 num_elems: NSUInteger,
93 byte_size: NSUInteger,
94) -> NonNull<c_void> {
95 extern "C-unwind" {
96 fn NSZoneCalloc(
97 zone: *mut NSZone,
98 num_elems: NSUInteger,
99 byte_size: NSUInteger,
100 ) -> Option<NonNull<c_void>>;
101 }
102 let ret = unsafe { NSZoneCalloc(zone, num_elems, byte_size) };
103 ret.expect("function was marked as returning non-null, but actually returned NULL")
104}
105
106#[inline]
111pub unsafe extern "C-unwind" fn NSZoneRealloc(
112 zone: *mut NSZone,
113 ptr: *mut c_void,
114 size: NSUInteger,
115) -> NonNull<c_void> {
116 extern "C-unwind" {
117 fn NSZoneRealloc(
118 zone: *mut NSZone,
119 ptr: *mut c_void,
120 size: NSUInteger,
121 ) -> Option<NonNull<c_void>>;
122 }
123 let ret = unsafe { NSZoneRealloc(zone, ptr, size) };
124 ret.expect("function was marked as returning non-null, but actually returned NULL")
125}
126
127extern "C-unwind" {
128 pub fn NSZoneFree(zone: *mut NSZone, ptr: NonNull<c_void>);
133}
134
135pub const NSScannedOption: NSUInteger = 1 << 0;
137pub const NSCollectorDisabledOption: NSUInteger = 1 << 1;
139
140#[inline]
141pub extern "C-unwind" fn NSAllocateCollectable(
142 size: NSUInteger,
143 options: NSUInteger,
144) -> NonNull<c_void> {
145 extern "C-unwind" {
146 fn NSAllocateCollectable(size: NSUInteger, options: NSUInteger) -> Option<NonNull<c_void>>;
147 }
148 let ret = unsafe { NSAllocateCollectable(size, options) };
149 ret.expect("function was marked as returning non-null, but actually returned NULL")
150}
151
152#[inline]
156pub unsafe extern "C-unwind" fn NSReallocateCollectable(
157 ptr: *mut c_void,
158 size: NSUInteger,
159 options: NSUInteger,
160) -> NonNull<c_void> {
161 extern "C-unwind" {
162 fn NSReallocateCollectable(
163 ptr: *mut c_void,
164 size: NSUInteger,
165 options: NSUInteger,
166 ) -> Option<NonNull<c_void>>;
167 }
168 let ret = unsafe { NSReallocateCollectable(ptr, size, options) };
169 ret.expect("function was marked as returning non-null, but actually returned NULL")
170}
171
172#[inline]
173pub extern "C-unwind" fn NSPageSize() -> NSUInteger {
174 extern "C-unwind" {
175 fn NSPageSize() -> NSUInteger;
176 }
177 unsafe { NSPageSize() }
178}
179
180#[inline]
181pub extern "C-unwind" fn NSLogPageSize() -> NSUInteger {
182 extern "C-unwind" {
183 fn NSLogPageSize() -> NSUInteger;
184 }
185 unsafe { NSLogPageSize() }
186}
187
188#[inline]
189pub extern "C-unwind" fn NSRoundUpToMultipleOfPageSize(bytes: NSUInteger) -> NSUInteger {
190 extern "C-unwind" {
191 fn NSRoundUpToMultipleOfPageSize(bytes: NSUInteger) -> NSUInteger;
192 }
193 unsafe { NSRoundUpToMultipleOfPageSize(bytes) }
194}
195
196#[inline]
197pub extern "C-unwind" fn NSRoundDownToMultipleOfPageSize(bytes: NSUInteger) -> NSUInteger {
198 extern "C-unwind" {
199 fn NSRoundDownToMultipleOfPageSize(bytes: NSUInteger) -> NSUInteger;
200 }
201 unsafe { NSRoundDownToMultipleOfPageSize(bytes) }
202}
203
204#[inline]
205pub extern "C-unwind" fn NSAllocateMemoryPages(bytes: NSUInteger) -> NonNull<c_void> {
206 extern "C-unwind" {
207 fn NSAllocateMemoryPages(bytes: NSUInteger) -> Option<NonNull<c_void>>;
208 }
209 let ret = unsafe { NSAllocateMemoryPages(bytes) };
210 ret.expect("function was marked as returning non-null, but actually returned NULL")
211}
212
213extern "C-unwind" {
214 pub fn NSDeallocateMemoryPages(ptr: NonNull<c_void>, bytes: NSUInteger);
218}
219
220extern "C-unwind" {
221 pub fn NSCopyMemoryPages(source: NonNull<c_void>, dest: NonNull<c_void>, bytes: NSUInteger);
226}
227
228#[deprecated = "Use NSProcessInfo instead"]
229#[inline]
230pub extern "C-unwind" fn NSRealMemoryAvailable() -> NSUInteger {
231 extern "C-unwind" {
232 fn NSRealMemoryAvailable() -> NSUInteger;
233 }
234 unsafe { NSRealMemoryAvailable() }
235}