1#![unstable(feature = "darwin_objc", issue = "145496")]
4#![allow(nonstandard_style)]
5
6use crate::fmt;
7
8#[repr(u8)]
10pub enum objc_class {
11 #[unstable(
12 feature = "objc_class_variant",
13 reason = "temporary implementation detail",
14 issue = "none"
15 )]
16 #[doc(hidden)]
17 __variant1,
18 #[unstable(
19 feature = "objc_class_variant",
20 reason = "temporary implementation detail",
21 issue = "none"
22 )]
23 #[doc(hidden)]
24 __variant2,
25}
26
27impl fmt::Debug for objc_class {
28 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
29 f.debug_struct("objc_class").finish()
30 }
31}
32
33#[repr(u8)]
35pub enum objc_selector {
36 #[unstable(
37 feature = "objc_selector_variant",
38 reason = "temporary implementation detail",
39 issue = "none"
40 )]
41 #[doc(hidden)]
42 __variant1,
43 #[unstable(
44 feature = "objc_selector_variant",
45 reason = "temporary implementation detail",
46 issue = "none"
47 )]
48 #[doc(hidden)]
49 __variant2,
50}
51
52impl fmt::Debug for objc_selector {
53 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
54 f.debug_struct("objc_selector").finish()
55 }
56}
57
58pub type Class = *mut objc_class;
60
61pub type SEL = *mut objc_selector;
63
64#[cfg_attr(target_os = "macos", doc = "```no_run")]
71#[cfg_attr(not(target_os = "macos"), doc = "```ignore (needs macos)")]
72#[allow_internal_unstable(rustc_attrs)]
78pub macro class($classname:expr) {{
79 unsafe extern "C" {
83 #[rustc_objc_class = $classname]
84 safe static VAL: $crate::os::darwin::objc::Class;
85 }
86 VAL
87}}
88
89#[cfg_attr(target_os = "macos", doc = "```no_run")]
98#[cfg_attr(not(target_os = "macos"), doc = "```ignore (needs macos)")]
99#[allow_internal_unstable(rustc_attrs)]
106pub macro selector($methname:expr) {{
107 unsafe extern "C" {
111 #[rustc_objc_selector = $methname]
112 safe static VAL: $crate::os::darwin::objc::SEL;
113 }
114 VAL
115}}