pub mod mac_types;
pub use mac_types::FourCharCode;
pub use mac_types::ResType;
pub use mac_types::UniChar;
pub use mac_types::four_cc_fmt_debug;
pub use mac_types::four_cc_to_str;
pub use mac_types::four_cc_to_string;
#[cfg(all(target_os = "macos", feature = "am"))]
pub mod am;
pub mod api;
pub mod arc;
#[cfg(feature = "at")]
pub mod at;
#[cfg(feature = "av")]
pub mod av;
#[cfg(all(target_os = "macos", feature = "ax"))]
pub mod ax;
#[cfg(feature = "blocks")]
pub mod blocks;
#[cfg(not(target_os = "watchos"))]
#[cfg(feature = "ca")]
pub mod ca;
#[cfg(feature = "cat")]
pub mod cat;
#[cfg(feature = "cf")]
pub mod cf;
#[cfg(feature = "cg")]
pub mod cg;
#[cfg(feature = "ci")]
pub mod ci;
#[cfg(feature = "cl")]
pub mod cl;
#[cfg(feature = "cm")]
pub mod cm;
#[cfg(all(target_os = "macos", feature = "core_audio"))]
pub mod core_audio;
#[cfg(not(target_os = "tvos"))]
#[cfg(feature = "core_motion")]
pub mod core_motion;
#[cfg(feature = "compression")]
pub mod compression;
#[cfg(feature = "ct")]
pub mod ct;
#[cfg(feature = "cv")]
pub mod cv;
#[cfg(target_os = "macos")]
#[cfg(feature = "da")]
pub mod da;
#[cfg(feature = "dispatch")]
pub mod dispatch;
pub mod dns_sd;
#[cfg(feature = "gc")]
pub mod gc;
pub mod io;
pub mod mach;
#[cfg(not(target_os = "watchos"))]
#[cfg(feature = "mc")]
pub mod mc;
#[cfg(feature = "mt")]
pub mod mt;
#[cfg(feature = "mtl")]
pub mod mtl;
#[cfg(feature = "mtl")]
pub mod mtl4;
#[cfg(feature = "mtk")]
pub mod mtk;
#[cfg(feature = "mlc")]
pub mod mlc;
#[cfg(feature = "mps")]
pub mod mps;
#[cfg(feature = "ml")]
pub mod ml;
#[cfg(feature = "ns")]
pub mod ns;
#[cfg(feature = "nl")]
pub mod nl;
#[cfg(feature = "nw")]
pub mod nw;
#[cfg(feature = "ns")]
pub mod objc;
pub mod os;
pub mod sys;
#[cfg(feature = "sec")]
pub mod sec;
#[cfg(feature = "vt")]
pub mod vt;
#[cfg(feature = "vdsp")]
pub mod vdsp;
#[cfg(feature = "vdsp")]
pub mod vimage;
#[cfg(feature = "cblas")]
mod cblas_new;
#[cfg(feature = "cblas")]
pub use cblas_new::catlas;
#[cfg(feature = "cblas")]
pub use cblas_new::cblas;
#[cfg(all(target_os = "macos", feature = "sc"))]
pub mod sc;
#[cfg(feature = "sn")]
pub mod sn;
#[cfg(all(
any(
target_os = "ios",
all(target_os = "ios", target_abi = "macabi",),
target_os = "tvos",
target_os = "watchos",
target_os = "visionos"
),
feature = "ui"
))]
pub mod ui;
#[cfg(feature = "ut")]
pub mod ut;
#[cfg(feature = "un")]
pub mod un;
pub mod time;
#[cfg(feature = "simd")]
pub mod simd;
#[cfg(feature = "vn")]
pub mod vn;
#[cfg(target_os = "ios")]
#[cfg(feature = "wc")]
pub mod wc;
#[cfg(not(any(target_os = "tvos", target_os = "watchos")))]
#[cfg(feature = "wk")]
pub mod wk;
#[macro_export]
macro_rules! define_opts {
(
$(#[$outer:meta])*
$vis:vis
$NewType:ident($BaseType:path)
) => {
$(#[$outer])*
#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, Default)]
#[repr(transparent)]
$vis struct $NewType(pub $BaseType);
impl $NewType {
#[inline]
pub fn is_empty(&self) -> bool {
self.0 == 0
}
pub fn any(&self, mask: Self) -> bool {
self.0 & mask.0 != 0
}
#[inline]
pub fn contains(&self, val: Self) -> bool {
*self & val == val
}
#[inline]
pub fn insert(&mut self, val: Self) {
*self |= val
}
#[inline]
pub fn remove(&mut self, val: Self) {
*self &= !val
}
#[inline]
pub fn set(&mut self, val: Self, on: bool) {
if on {
self.insert(val)
} else {
self.remove(val)
}
}
}
impl ::std::ops::BitAndAssign for $NewType {
#[inline]
fn bitand_assign(&mut self, rhs: Self) {
*self = Self(self.0 & rhs.0)
}
}
impl ::std::ops::BitAnd for $NewType {
type Output = $NewType;
#[inline]
fn bitand(self, rhs: Self) -> Self {
Self(self.0 & rhs.0)
}
}
impl ::std::ops::BitOr for $NewType {
type Output = $NewType;
#[inline]
fn bitor(self, rhs: Self) -> Self {
Self(self.0 | rhs.0)
}
}
impl ::std::ops::BitOrAssign for $NewType {
#[inline]
fn bitor_assign(&mut self, rhs: Self) {
*self = Self(self.0 | rhs.0)
}
}
impl ::std::ops::BitXor for $NewType {
type Output = Self;
#[inline]
fn bitxor(self, rhs: Self) -> Self::Output {
Self(self.0 ^ rhs.0)
}
}
impl ::std::ops::BitXorAssign for $NewType {
#[inline]
fn bitxor_assign(&mut self, rhs: Self) {
self.0 ^= rhs.0
}
}
impl ::std::ops::Not for $NewType {
type Output = Self;
#[inline]
fn not(self) -> Self::Output {
Self(!self.0)
}
}
impl ::std::convert::From<$BaseType> for $NewType {
#[inline]
fn from(value: $BaseType) -> Self {
Self(value)
}
}
impl ::std::fmt::Binary for $NewType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
::std::fmt::Binary::fmt(&self.0, f)
}
}
};
}
#[cfg(test)]
mod tests {
use crate::cf;
#[test]
fn it_works() {
let f = {
let null = cf::Null::value();
null.show();
let num = cf::Number::from_i16(0);
let arr = cf::Array::from_type_refs(&[null, &num]).unwrap();
let v = b"he".to_vec();
let _s = cf::String::create_with_bytes_no_copy_in(
&v,
cf::StringEncoding::UTF8,
false,
cf::Allocator::null(),
None,
)
.unwrap();
let _f = num;
arr.show();
arr
};
f.show()
}
}