objc2_io_kit/
lib.rs

1//! # Bindings to the `IOKit` 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/iokit/
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(docsrs, feature(doc_cfg))]
10// Update in Cargo.toml as well.
11#![doc(html_root_url = "https://docs.rs/objc2-io-kit/0.3.2")]
12
13#[cfg(feature = "alloc")]
14extern crate alloc;
15
16#[cfg(feature = "std")]
17extern crate std;
18
19#[cfg(feature = "libc")]
20mod consumes_argument;
21mod generated;
22mod macros;
23
24#[cfg(feature = "libc")]
25#[allow(unused_imports, unreachable_pub)]
26pub use self::consumes_argument::*;
27#[allow(unused_imports, unreachable_pub)]
28pub use self::generated::*;
29#[allow(unused_imports, unreachable_pub)]
30pub use self::macros::*;
31
32// IOKit/IOReturn.h
33/// [Apple's documentation](https://developer.apple.com/documentation/iokit/ioreturn?language=objc)
34pub type IOReturn = core::ffi::c_int; // kern_return_t
35
36/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kioreturnsuccess?language=objc)
37#[allow(non_upper_case_globals)]
38pub const kIOReturnSuccess: IOReturn = 0;
39
40// IOKit/IOPM.h
41/// [Apple's documentation](https://developer.apple.com/documentation/kernel/2876248-anonymous/kiopsfamilycodeunsupported/)
42#[allow(non_upper_case_globals)]
43pub const kIOPSFamilyCodeUnsupported: core::ffi::c_int = kIOReturnUnsupported as core::ffi::c_int;
44
45// MacTypes.h
46#[allow(dead_code)]
47pub(crate) type Boolean = u8;
48#[allow(dead_code)]
49pub(crate) type AbsoluteTime = i32;
50#[allow(dead_code)]
51pub(crate) type NumVersion = u32; // Actually a struct with 4 u8s
52#[allow(dead_code)]
53pub(crate) type FourCharCode = u32;
54
55// device/device_types.h
56#[allow(dead_code, non_camel_case_types)]
57pub(crate) type io_name_t = *mut [core::ffi::c_char; 128];
58#[allow(dead_code, non_camel_case_types)]
59pub(crate) type io_string_t = *mut [core::ffi::c_char; 512];
60#[allow(dead_code, non_camel_case_types)]
61pub(crate) type io_struct_inband_t = *mut [core::ffi::c_char; 4096];
62
63// uuid/uuid_t.h
64#[allow(dead_code, non_camel_case_types)]
65pub(crate) type uuid_t = [u8; 16]; // Usage sites are all in structs
66
67/// [Apple's documentation](https://developer.apple.com/documentation/iokit/io_object_null?language=objc)
68#[cfg(feature = "libc")]
69pub const IO_OBJECT_NULL: io_object_t = 0;
70
71// mach/mach_types.h
72#[allow(dead_code, non_camel_case_types)]
73#[cfg(feature = "libc")]
74pub(crate) type task_port_t = libc::task_t;