Source code

Revision control

Copy as Markdown

Other Tools

//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use crate::*;
#[inline]
pub extern "C-unwind" fn NSDefaultMallocZone() -> NonNull<NSZone> {
extern "C-unwind" {
fn NSDefaultMallocZone() -> Option<NonNull<NSZone>>;
}
let ret = unsafe { NSDefaultMallocZone() };
ret.expect("function was marked as returning non-null, but actually returned NULL")
}
#[inline]
pub extern "C-unwind" fn NSCreateZone(
start_size: NSUInteger,
granularity: NSUInteger,
can_free: bool,
) -> NonNull<NSZone> {
extern "C-unwind" {
fn NSCreateZone(
start_size: NSUInteger,
granularity: NSUInteger,
can_free: Bool,
) -> Option<NonNull<NSZone>>;
}
let ret = unsafe { NSCreateZone(start_size, granularity, Bool::new(can_free)) };
ret.expect("function was marked as returning non-null, but actually returned NULL")
}
extern "C-unwind" {
/// # Safety
///
/// `zone` must be a valid pointer.
pub fn NSRecycleZone(zone: NonNull<NSZone>);
}
extern "C-unwind" {
/// # Safety
///
/// `zone` must be a valid pointer or null.
#[cfg(feature = "NSString")]
pub fn NSSetZoneName(zone: *mut NSZone, name: &NSString);
}
/// # Safety
///
/// `zone` must be a valid pointer or null.
#[cfg(feature = "NSString")]
#[inline]
pub unsafe extern "C-unwind" fn NSZoneName(zone: *mut NSZone) -> Retained<NSString> {
extern "C-unwind" {
fn NSZoneName(zone: *mut NSZone) -> *mut NSString;
}
let ret = unsafe { NSZoneName(zone) };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
extern "C-unwind" {
/// # Safety
///
/// `ptr` must be a valid pointer.
pub fn NSZoneFromPointer(ptr: NonNull<c_void>) -> *mut NSZone;
}
/// # Safety
///
/// `zone` must be a valid pointer or null.
#[inline]
pub unsafe extern "C-unwind" fn NSZoneMalloc(
zone: *mut NSZone,
size: NSUInteger,
) -> NonNull<c_void> {
extern "C-unwind" {
fn NSZoneMalloc(zone: *mut NSZone, size: NSUInteger) -> Option<NonNull<c_void>>;
}
let ret = unsafe { NSZoneMalloc(zone, size) };
ret.expect("function was marked as returning non-null, but actually returned NULL")
}
/// # Safety
///
/// `zone` must be a valid pointer or null.
#[inline]
pub unsafe extern "C-unwind" fn NSZoneCalloc(
zone: *mut NSZone,
num_elems: NSUInteger,
byte_size: NSUInteger,
) -> NonNull<c_void> {
extern "C-unwind" {
fn NSZoneCalloc(
zone: *mut NSZone,
num_elems: NSUInteger,
byte_size: NSUInteger,
) -> Option<NonNull<c_void>>;
}
let ret = unsafe { NSZoneCalloc(zone, num_elems, byte_size) };
ret.expect("function was marked as returning non-null, but actually returned NULL")
}
/// # Safety
///
/// - `zone` must be a valid pointer or null.
/// - `ptr` must be a valid pointer or null.
#[inline]
pub unsafe extern "C-unwind" fn NSZoneRealloc(
zone: *mut NSZone,
ptr: *mut c_void,
size: NSUInteger,
) -> NonNull<c_void> {
extern "C-unwind" {
fn NSZoneRealloc(
zone: *mut NSZone,
ptr: *mut c_void,
size: NSUInteger,
) -> Option<NonNull<c_void>>;
}
let ret = unsafe { NSZoneRealloc(zone, ptr, size) };
ret.expect("function was marked as returning non-null, but actually returned NULL")
}
extern "C-unwind" {
/// # Safety
///
/// - `zone` must be a valid pointer or null.
/// - `ptr` must be a valid pointer.
pub fn NSZoneFree(zone: *mut NSZone, ptr: NonNull<c_void>);
}
pub const NSScannedOption: NSUInteger = 1 << 0;
pub const NSCollectorDisabledOption: NSUInteger = 1 << 1;
#[inline]
pub extern "C-unwind" fn NSAllocateCollectable(
size: NSUInteger,
options: NSUInteger,
) -> NonNull<c_void> {
extern "C-unwind" {
fn NSAllocateCollectable(size: NSUInteger, options: NSUInteger) -> Option<NonNull<c_void>>;
}
let ret = unsafe { NSAllocateCollectable(size, options) };
ret.expect("function was marked as returning non-null, but actually returned NULL")
}
/// # Safety
///
/// `ptr` must be a valid pointer or null.
#[inline]
pub unsafe extern "C-unwind" fn NSReallocateCollectable(
ptr: *mut c_void,
size: NSUInteger,
options: NSUInteger,
) -> NonNull<c_void> {
extern "C-unwind" {
fn NSReallocateCollectable(
ptr: *mut c_void,
size: NSUInteger,
options: NSUInteger,
) -> Option<NonNull<c_void>>;
}
let ret = unsafe { NSReallocateCollectable(ptr, size, options) };
ret.expect("function was marked as returning non-null, but actually returned NULL")
}
#[inline]
pub extern "C-unwind" fn NSPageSize() -> NSUInteger {
extern "C-unwind" {
fn NSPageSize() -> NSUInteger;
}
unsafe { NSPageSize() }
}
#[inline]
pub extern "C-unwind" fn NSLogPageSize() -> NSUInteger {
extern "C-unwind" {
fn NSLogPageSize() -> NSUInteger;
}
unsafe { NSLogPageSize() }
}
#[inline]
pub extern "C-unwind" fn NSRoundUpToMultipleOfPageSize(bytes: NSUInteger) -> NSUInteger {
extern "C-unwind" {
fn NSRoundUpToMultipleOfPageSize(bytes: NSUInteger) -> NSUInteger;
}
unsafe { NSRoundUpToMultipleOfPageSize(bytes) }
}
#[inline]
pub extern "C-unwind" fn NSRoundDownToMultipleOfPageSize(bytes: NSUInteger) -> NSUInteger {
extern "C-unwind" {
fn NSRoundDownToMultipleOfPageSize(bytes: NSUInteger) -> NSUInteger;
}
unsafe { NSRoundDownToMultipleOfPageSize(bytes) }
}
#[inline]
pub extern "C-unwind" fn NSAllocateMemoryPages(bytes: NSUInteger) -> NonNull<c_void> {
extern "C-unwind" {
fn NSAllocateMemoryPages(bytes: NSUInteger) -> Option<NonNull<c_void>>;
}
let ret = unsafe { NSAllocateMemoryPages(bytes) };
ret.expect("function was marked as returning non-null, but actually returned NULL")
}
extern "C-unwind" {
/// # Safety
///
/// `ptr` must be a valid pointer.
pub fn NSDeallocateMemoryPages(ptr: NonNull<c_void>, bytes: NSUInteger);
}
extern "C-unwind" {
/// # Safety
///
/// - `source` must be a valid pointer.
/// - `dest` must be a valid pointer.
pub fn NSCopyMemoryPages(source: NonNull<c_void>, dest: NonNull<c_void>, bytes: NSUInteger);
}
#[deprecated = "Use NSProcessInfo instead"]
#[inline]
pub extern "C-unwind" fn NSRealMemoryAvailable() -> NSUInteger {
extern "C-unwind" {
fn NSRealMemoryAvailable() -> NSUInteger;
}
unsafe { NSRealMemoryAvailable() }
}