mod cf_allocator;
mod cf_array;
mod cf_data;
mod cf_dictionary;
mod cf_number;
mod cf_range;
mod cf_string;
mod cf_type;
mod cf_url;
use std::ffi::c_void;
pub(crate) use self::{
cf_allocator::CFAllocatorRef,
cf_array::{CFArray, CFArrayIterator, CFArrayRef},
cf_data::{CFData, CFDataRef},
cf_dictionary::CFDictionary,
cf_number::{CFNumber, CFNumberType},
cf_range::CFRange,
cf_string::{CFString, CFStringRef},
cf_type::{CFType, CFTypeRef},
cf_url::CFURL,
};
pub type CFIndex = isize;
pub(super) trait CFSerializable {
fn from_ptr(ptr: *const c_void) -> Self;
fn to_ptr(&self) -> *const c_void;
}
impl AutoCFSerialize for u32 {}
pub trait AutoCFSerialize {}
impl<T> CFSerializable for T
where T: Copy + Sized + AutoCFSerialize {
fn from_ptr(ptr: *const c_void) -> Self {
unsafe { *(&ptr as *const *const c_void as *const T) }
}
fn to_ptr(&self) -> *const c_void {
(self as *const Self) as *const c_void
}
}