Skip to main content

objc2_core_foundation/
lib.rs

1//! # Bindings to the `CoreFoundation` framework
2//!
3//! See [Apple's docs][apple-doc] and [the general docs on framework crates][framework-crates] for more information.
4//!
5//! [apple-doc]: https://developer.apple.com/documentation/corefoundation/
6//! [framework-crates]: https://docs.rs/objc2/latest/objc2/topics/about_generated/index.html
7#![no_std]
8#![cfg_attr(feature = "unstable-darwin-objc", feature(darwin_objc))]
9#![cfg_attr(feature = "unstable-coerce-pointee", feature(derive_coerce_pointee))]
10#![cfg_attr(docsrs, feature(doc_cfg))]
11// Update in Cargo.toml as well.
12#![doc(html_root_url = "https://docs.rs/objc2-core-foundation/0.3.2")]
13
14#[cfg(any(test, feature = "alloc"))]
15extern crate alloc;
16
17#[cfg(feature = "std")]
18extern crate std;
19
20#[doc(hidden)]
21pub mod __cf_macro_helpers;
22#[cfg(feature = "CFArray")]
23mod array;
24mod base;
25#[cfg(feature = "CFBundle")]
26mod bundle;
27mod cf_type;
28#[cfg(feature = "CFData")]
29mod data;
30#[cfg(feature = "CFDate")]
31mod date;
32#[cfg(feature = "CFDictionary")]
33mod dictionary;
34#[cfg(feature = "CFError")]
35mod error;
36#[cfg(feature = "CFFileDescriptor")]
37mod filedescriptor;
38// Allow `default` methods on CFAllocator and CFTimeZone
39#[allow(clippy::should_implement_trait)]
40mod generated;
41#[cfg(feature = "CFCGTypes")]
42mod geometry;
43#[cfg(feature = "CFNumber")]
44mod number;
45mod opaque;
46mod retained;
47#[cfg(feature = "CFString")]
48mod string;
49mod thread_safety;
50#[cfg(feature = "CFTimeZone")]
51mod timezone;
52mod type_traits;
53#[cfg(feature = "CFURL")]
54mod url;
55#[cfg(feature = "CFUserNotification")]
56mod user_notification;
57#[cfg(feature = "CFUUID")]
58mod uuid;
59
60#[cfg(feature = "CFArray")]
61pub use self::array::*;
62pub use self::base::*;
63#[cfg(feature = "CFBundle")]
64pub use self::bundle::CFBundleRefNum;
65#[allow(unused_imports, unreachable_pub)]
66pub use self::generated::*;
67#[cfg(feature = "CFCGTypes")]
68pub use self::geometry::*;
69pub use self::retained::CFRetained;
70pub use self::type_traits::{ConcreteType, Type};
71
72// This is not exposed publicly, so the only way to use this in types with
73// generics is to use it through the default type (e.g. the user should write
74// `CFArray` instead of `CFArray<Opaque>`).
75#[allow(unused_imports)]
76pub(crate) use self::opaque::Opaque;
77
78// MacTypes.h
79#[allow(dead_code)]
80mod mac_types {
81    pub(crate) type Boolean = u8; // unsigned char
82    pub(crate) type ConstStr255Param = *const core::ffi::c_char;
83    pub(crate) type ConstStringPtr = *const core::ffi::c_char;
84    pub(crate) type FourCharCode = u32;
85    pub(crate) type LangCode = i16;
86    pub(crate) type OSType = FourCharCode;
87    pub(crate) type RegionCode = i16;
88    pub(crate) type ResType = FourCharCode;
89    pub(crate) type StringPtr = *mut core::ffi::c_char;
90    pub(crate) type UniChar = u16;
91    pub(crate) type UTF32Char = u32; // Or maybe Rust's char?
92}
93
94#[allow(unused_imports)]
95pub(crate) use self::mac_types::*;