1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/// Creates a [`&'static str`](https://doc.rust-lang.org/std/primitive.str.html)
/// from a selector literal, that may be used as the basis of a
/// [`SEL`](objc/struct.SEL.html).
///
/// # Feature Flag
///
/// This macro is defined in [`objc`](objc/index.html),
/// which requires the **`objc`**
/// [feature flag](index.html#feature-flags).
///
/// # Examples
///
/// This macro accepts anything that can go in Objective-C's `@selector`:
///
/// ```
/// use fruity::selector_str;
///
/// assert_eq!(selector_str!(init), "init\0");
///
/// assert_eq!(selector_str!(initWithArg:), "initWithArg:\0");
/// assert_eq!(selector_str!(initWithArg : ), "initWithArg:\0");
///
/// assert_eq!(selector_str!(initWithArg:arg2:), "initWithArg:arg2:\0");
/// assert_eq!(selector_str!(initWithArg : arg2 : ), "initWithArg:arg2:\0");
/// ```
///
/// The result of the macro can even be used in a `const`:
///
/// ```
/// # use fruity::selector_str;
/// const SEL: &str = selector_str!(initWithArg:);
/// ```
///
/// Invalid selectors will fail to compile:
///
/// ```compile_fail
/// # use fruity::selector_str;
/// let sel = selector_str!(initWithArg::);
/// ```
/// Creates a [`SEL`](objc/struct.SEL.html) from a selector literal.
///
/// # Feature Flag
///
/// This macro is defined in [`objc`](objc/index.html),
/// which requires the **`objc`**
/// [feature flag](index.html#feature-flags).
///
/// # Examples
///
/// This macro accepts anything that can go in Objective-C's `@selector`:
///
/// ```
/// use fruity::selector;
///
/// let sel = selector!(init);
/// let sel = selector!(initWithArg:);
/// let sel = selector!(initWithArg:arg2:);
/// ```
///
/// Invalid selectors will fail to compile:
///
/// ```compile_fail
/// # use fruity::selector;
/// let sel = selector!(initWithArg::);
/// ```