diff --git a/core-foundation-sys/src/lib.rs b/core-foundation-sys/src/lib.rs index b4e8825..a00e8bb 100644 --- a/core-foundation-sys/src/lib.rs +++ b/core-foundation-sys/src/lib.rs @@ -4,3 +4,4 @@ extern crate libc; pub mod array; pub mod base; +pub mod number; diff --git a/core-foundation-sys/src/number.rs b/core-foundation-sys/src/number.rs new file mode 100644 index 0000000..99b9c49 --- /dev/null +++ b/core-foundation-sys/src/number.rs @@ -0,0 +1,12 @@ +use libc::c_void; + +use base::CFTypeID; + +pub type CFBooleanRef = *const c_void; + +extern { + pub static kCFBooleanTrue: CFBooleanRef; + pub static kCFBooleanFalse: CFBooleanRef; + + pub fn CFBooleanGetTypeID() -> CFTypeID; +} diff --git a/core-foundation/src/boolean.rs b/core-foundation/src/boolean.rs index 06b2f57..b8d4288 100644 --- a/core-foundation/src/boolean.rs +++ b/core-foundation/src/boolean.rs @@ -9,18 +9,12 @@ //! A Boolean type. -use core_foundation_sys::base::{CFRelease, CFTypeID}; +use core_foundation_sys::base::{CFRelease}; +use core_foundation_sys::number::{CFBooleanRef, CFBooleanGetTypeID, kCFBooleanTrue, kCFBooleanFalse}; use std::mem; use base::TCFType; -pub type Boolean = u32; - -#[repr(C)] -struct __CFBoolean; - -pub type CFBooleanRef = *const __CFBoolean; - /// A Boolean type. /// /// FIXME(pcwalton): Should be a newtype struct, but that fails due to a Rust compiler bug. @@ -49,12 +43,3 @@ impl CFBoolean { } } } - -#[link(name = "CoreFoundation", kind = "framework")] -extern { - static kCFBooleanTrue: CFBooleanRef; - static kCFBooleanFalse: CFBooleanRef; - - fn CFBooleanGetTypeID() -> CFTypeID; -} -